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
- Could not resolve host: 'localhost 報錯解決辦法localhost
- c# Api 錯誤 Unable to resolve service for type while attempting to activate C#APIWhile
- How to Diagnose and Resolve UNABLE TO EXTEND ErrorsError
- sudo 出現unable to resolve host 解決方法
- eslint-plugin-import Unable to resolve path to moduleEsLintPluginImport
- Android Unable to resolve target 'android-X'Android
- 【DataGuard】 TNS:could not resolve the connect identifier specifiedIDE
- hadoop啟動時,報ssh: Could not resolve hostname xxx: NamHadoop
- ORA-12154: TNS:could not resolve service name / TNS-03505: Failed to resolve nameAI
- gradle升級到4.1後出現的Could not resolve com.android.tools.build:gradle:3.0.1GradleAndroidUI
- Centos7中Could not resolve host: mirrorlist.centos.org; 未知的錯誤"CentOS
- sudo時出現unable to resolve host 的解決方法
- 異常org.hibernate.QueryException: could not resolve property的原因Exception
- yml:java.lang.IllegalArgumentException: Could not resolve placeholder ‘jdbc.driverClassName‘JavaExceptionJDBC
- 升級pip報錯ERROR: Could not install packages due to an OSError: [WinError 5]ErrorPackage
- DaVinci Resolve Studio 18:創意無限,功能升級 mac/win版Mac
- ORA-12154: TNS:could not resolve the connect identifier specifiedIDE
- ORA-12154: TNS: could not resolve the connect identifier specifiedIDE
- activemq升級報錯MQ
- Could not resolve placeholder 'redis.pool.maxTotal' in string value "${redis.pool.maxTotal}"Redis
- Promise.resolve() 方法Promise
- lua 中連結 Redis 使用域名報錯 failed to connect: no resolver defined to resolveRedisAI
- 記錄:yum Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error解決CloudError
- Could not resolve com.android.support.constraint:constraint-layout:1.1.3AndroidAI
- webpack系列之三resolveWeb
- Failed to resolve:com.android.support:appcompat-v7:報錯處理AIAndroidAPP
- android 新增依賴出現Failed to resolve:"你新增的依賴名" 或者出現 debug@Compileclasspath問題AndroidAICompile
- Oracle案例09——ORA-12154: TNS:could not resolve the connect identifier specifiedOracleIDE
- Could not resolve org.jetbrains.intellij.plugins:gradle-intellij-pluginAIIntelliJPluginGradle
- 資料庫升級報錯資料庫
- Promise(resolve,reject)的基本使用Promise
- Oracle 10g ORA-12154: TNS: could not resolve the connect identifier specifiedOracle 10gIDE
- Maven Dependency Version:依賴版本自動升級Maven
- oracle 升級報錯 NO pre-requistes......OracleUI
- 關於ORA-12154: TNS:could not resolve the connect identifier specified的問題IDE
- django rest django.core.exceptions.ImproperlyConfigured: Could not resolve URL for hyperlinked relationship using view nameDjangoRESTExceptionView
- 【Vue】路由按需載入(路由懶載入) component: resolve => require([‘../pages/home.vue‘], resolve)Vue路由UI