各位好,我是剛開始學習 Android開發。昨天安裝完畢Android Studio后,創建一個新的project。但始侄訓收到一個報錯
資訊如下
A problem occurred configuring root project 'My First Application'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.6.1.
Required by:
project :
> No cached version of com.android.tools.build:gradle:3.6.1 available for offline mode.
> No cached version of com.android.tools.build:gradle:3.6.1 available for offline mode.
我當前的Android Studio 版本 3.6.1
網上搜索相關資訊,提供解決辦法基本如下
1. Setup-> Build, Execution, Deployment -> Gradle 設定 Offline Work,取消勾選Offine work,選擇回默認的gradle wrapper
但我的系統里沒有這個選項。
另外,看到其他人的setup 截屏中 Setup-> Build, Execution, Deployment -> Gradle 下面還有 Android Studio 或 Experimental 子項。我的系統中都沒有。
附系統界面截屏圖片

還望前輩指點,這是什么原因。
該如何來解決。
感謝之至
uj5u.com熱心網友回復:
應該是gradle沒有安裝好,你改一下url試試
maven {
url "http://nexus.jrj.com.cn/nexus/content/groups/public/"
}
uj5u.com熱心網友回復:
我嘗試在 Build.gradle() 中添加了如下代碼,問題還是同樣。
maven {
url "http://nexus.jrj.com.cn/nexus/content/groups/public/"
}
Gradle 沒有安裝好,該如何重新安裝?還請版主指點 多謝
uj5u.com熱心網友回復:
網上找到一些相關的操作方法供與我遇到相同問題的伙伴參考(希望有所幫助):
Step 1: Go to the download site from Gradle: https://gradle.org/releases/
Step 2: Extract the downloaded zip file into a directory.
Step 2: Hit Ctrl + Alt + S (mac: ? + ,) in Android studio/Intellij IDEA
Step 3: Goto: Build, Execution, Deployment >> Build Tools >> Gradle (Or just type in the searchbar Gradle)
Step 4: Select: (X) Use local gradle distribution and set Gradle home to your extracted Gradle directory. Click on apply.
Step 5: Get rid of your unnecessary gradle files delete:
- MyApp/gradle/
- gradlew
- gradlew.bat
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/58737.html
標籤:Android
