AndroidStudio升級報錯Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve c
近日升級AS到3.2.1版本,新建工程時報錯:
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0.
Open File
Show Details
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.3.
Open File
Show Details
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.test:runner:1.0.2.
Open File
Show Details
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.test.espresso:espresso-core:3.0.2.
Open File
Show Details
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0.
Open File
Show Details
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.3.
Open File
Show Details
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0.
Open File
Show Details
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.3.
Open File
Show Details
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve junit:junit:4.12.
Open File
Show Details
錯誤原因:專案預設配置了gradle 4.6版本,映象伺服器錯誤(mirrors.neusoft.edu.cn 沒有提供下載服務)導致無法下載gradle-4.6-all.zip,無法完成編譯。
解決方法1:降低gradle版本
-
開啟 gradle/wrapper/gradle-wrapper.properties,修改gradle版本為本地已下載版本。如gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
記得同時修改build.gradle內容:3.1.0
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
解決方法2:更新到最新版本
- 不使用映象地址下載gradle-4.6-all.zip,因為映象地址連線失敗,所以把它拿掉。
找到/Users/lvxiangan/.gradle資料夾,開啟gradle.properties
## For more details on how to configure your build environment visit
或者刪除整個檔案。重啟AS,可以看到正在重新下載gradle-4.6-all.zip
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Thu Dec 06 23:52:05 CST 2018
使用#號註釋掉以下4行
systemProp.http.proxyHost=mirrors.neusoft.edu.cn
systemProp.http.proxyPort=80
systemProp.https.proxyHost=mirrors.neusoft.edu.cn
systemProp.https.proxyPort=80
- 如果上一步下載很慢,可以通過網盤或迅雷下載到本地,從本地直接載入。
下載好複製到 /Users/lvxiangan/.gradle/wrapper/dists/gradle-4.6-all/bcst21l2brirad8k2ben1letg 資料夾下,然後重啟AS。
注意:bcst21l2brirad8k2ben1letg 資料夾名稱是由系統隨機產生,請不要嘗試修改它。
最後來一張成功編譯圖,晚安!
相關文章
- vue3 引入 element-ui 報錯 - ERR! ERESOLVE unable to resolve dependency treeVueUI
- c# Api 錯誤 Unable to resolve service for type while attempting to activate C#APIWhile
- hadoop啟動時,報ssh: Could not resolve hostname xxx: NamHadoop
- eslint-plugin-import Unable to resolve path to moduleEsLintPluginImport
- gradle升級到4.1後出現的Could not resolve com.android.tools.build:gradle:3.0.1GradleAndroidUI
- sudo 出現unable to resolve host 解決方法
- Centos7中Could not resolve host: mirrorlist.centos.org; 未知的錯誤"CentOS
- springboot報錯無法讀取配置檔案中的屬性:Could not resolve placeholder ‘xxxx‘ in value “${xxxx}Spring Boot
- sudo時出現unable to resolve host 的解決方法
- yml:java.lang.IllegalArgumentException: Could not resolve placeholder ‘jdbc.driverClassName‘JavaExceptionJDBC
- Could not resolve org.jetbrains.intellij.plugins:gradle-intellij-pluginAIIntelliJPluginGradle
- Could not resolve com.android.support.constraint:constraint-layout:1.1.3AndroidAI
- Oracle案例09——ORA-12154: TNS:could not resolve the connect identifier specifiedOracleIDE
- DaVinci Resolve Studio 18:創意無限,功能升級 mac/win版Mac
- 升級pip報錯ERROR: Could not install packages due to an OSError: [WinError 5]ErrorPackage
- lua 中連結 Redis 使用域名報錯 failed to connect: no resolver defined to resolveRedisAI
- django rest django.core.exceptions.ImproperlyConfigured: Could not resolve URL for hyperlinked relationship using view nameDjangoRESTExceptionView
- 記錄:yum Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error解決CloudError
- Promise.resolve() 方法Promise
- android 新增依賴出現Failed to resolve:"你新增的依賴名" 或者出現 debug@Compileclasspath問題AndroidAICompile
- webpack系列之三resolveWeb
- Android Studio報錯:ERROR: Failed to resolve: com.android.support:appcompat-v7:28.0.+AndroidErrorAIAPP
- node中的path.resolve
- Promise(resolve,reject)的基本使用Promise
- 【Vue】路由按需載入(路由懶載入) component: resolve => require([‘../pages/home.vue‘], resolve)Vue路由UI
- android studio 中 Cannot resolve symbol RAndroidSymbol
- DaVinci Resolve Studio 16達芬奇——MacwMac
- 【scala】問題cannot resolve symbol sparkSymbolSpark
- Promise 原始碼:同步執行 resolvePromise原始碼
- 深入理解-dl_runtime_resolve
- Maven Dependency Version:依賴版本自動升級Maven
- DaVinci Resolve Studio 18頂級達芬奇剪輯調色軟體
- Promise 原始碼:非同步執行 resolvePromise原始碼非同步
- ERROR: Failed to resolve: org.greenrobot:eventbus:2.4.0ErrorAI
- angularjs中,為什麼要使用resolve?AngularJS
- 達芬奇剪輯DaVinci Resolve Studio 18
- pip install scrapy報錯:error: UnableError
- not found, please resolve and reinstall android driver 試了 global 好幾個版本了,mac,win 都報這個錯AndroidMac