Unable to resolve dependency for ...: Could not resolve com.android.support: ...
阿新 • • 發佈:2018-11-17
錯誤內容:
Unable to resolve dependency for ':[email protected]/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.1.0.
Open File
Show Details
Unable to resolve dependency for ':[email protected]/compileClasspath': Could not resolve com.android.support.test:runner:1.0.1 .
Open File
Show Details
Unable to resolve dependency for ':[email protected]/compileClasspath': Could not resolve com.android.support.test.espresso:espresso-core:3.0.1.
Open File
Show Details
解決方案
1. 修改檔案 build.gradle
將
dependencies {
...
}
修改為:
dependencies {
implementation fileTree(dir : 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:0.4'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
}
2. 修改之後build可能會又出現如下錯誤:
Unable to resolve dependency for ':[email protected]/compileClasspath': Could not resolve jwriter:jwriter:2.1.1.
Unable to resolve dependency for ':[email protected]/compileClasspath': Could not resolve junit:junit:4.12.
再將上述部分修改為:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
//testImplementation 'junit:junit:4.12'
//androidTestImplementation 'com.android.support.test:runner:0.4'
//androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
3. 再次build之後還有可能出現以下錯誤:
No resource identifier found for attribute 'layout_behavior' in package
再將上述部分修改為:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
//testImplementation 'junit:junit:4.12'
//androidTestImplementation 'com.android.support.test:runner:0.4'
//androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'