无法解析 com.android.support:design:26.1.0
Could not resolve com.android.support:design:26.1.0
我遇到这个问题已经有一段时间了,我的 com.android.support:design:26.1.0
让我失望了,我不知道该改变什么了。
这些是我的模块 gradle 的文件。
Build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.xxx.yyy"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.google.android.gms:play-services-vision:9.4.0'
// compile 'com.android.support:design:26.1.0'
}
//apply plugin: 'com.google.gms.google-services'
The project gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter({ url "http://jcenter.bintray.com/" })
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter({ url "http://jcenter.bintray.com/" })
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Error:Unable to resolve dependency for
':app@releaseUnitTest/compileClasspath': Could not resolve
com.android.support:design:26.1.0.
Error:Unable to resolve dependency
for ':app@release/compileClasspath': Could not resolve
com.android.support:design:26.1.0.
Error:Unable to resolve dependency
for ':app@debugUnitTest/compileClasspath': Could not resolve
com.android.support:design:26.1.0.
Error:Unable to resolve dependency
for ':app@debugAndroidTest/compileClasspath': Could not resolve
com.android.support:design:26.1.0.
Error:Unable to resolve dependency
for ':app@debug/compileClasspath': Could not resolve
com.android.support:design:26.1.0.
只有 'Snackbar' 功能不起作用,但其余功能似乎都很好。
当我将设计改为 25.1.0 版本时,它可以工作,但它与其他 26.1.0 版本冲突,因此 Android Studio 不推荐它。任何人..?
我试过
compile 'com.android.support:design:26.1.0'
而不是实施,它不起作用。当我试图将整个东西更改为 25.4.0 或任何其他 25 版本时,很多其他东西也无法编译。我已经取消选中离线工作,尝试删除/添加 maven 目录,取消注释更多的依赖项,将所有更改为编译而不是实现,但只会给我更多错误。
是的,我已将所有 SDK 更新到最新版本,但我感觉 Gradle 无法从网站下载某些依赖项,这就是我无法下载更多其他依赖项的原因。 (虽然我的离线工作是未勾选的)
此外,无论上面的代码中没有注释什么,这意味着我已经尝试输入这些行,但它没有解决问题,而是产生了更多问题。
这是我找到它的方式,请尝试以下
Go to File->Settings->Build, Execution, Deployment->Gradle->Uncheck Offline work option.
尝试一次,而不是实施编译设计支持gradle代码
compile 'com.android.support:design:26.1.0'
并删除这个
implementation 'com.android.support:design:26.1.0'
我最后意识到的问题是,我在设置android代理时,只设置了1个HTTP代理,没有意识到没有设置HTTPS代理。
所以通过设置 HTTPS 代理解决了这个问题后,就没有问题了。
我遇到这个问题已经有一段时间了,我的 com.android.support:design:26.1.0
让我失望了,我不知道该改变什么了。
这些是我的模块 gradle 的文件。
Build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.xxx.yyy"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.google.android.gms:play-services-vision:9.4.0'
// compile 'com.android.support:design:26.1.0'
}
//apply plugin: 'com.google.gms.google-services'
The project gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter({ url "http://jcenter.bintray.com/" })
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter({ url "http://jcenter.bintray.com/" })
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Error:Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.android.support:design:26.1.0.
Error:Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.android.support:design:26.1.0.
Error:Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.android.support:design:26.1.0.
Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support:design:26.1.0.
Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:design:26.1.0.
只有 'Snackbar' 功能不起作用,但其余功能似乎都很好。
当我将设计改为 25.1.0 版本时,它可以工作,但它与其他 26.1.0 版本冲突,因此 Android Studio 不推荐它。任何人..?
我试过
compile 'com.android.support:design:26.1.0'
而不是实施,它不起作用。当我试图将整个东西更改为 25.4.0 或任何其他 25 版本时,很多其他东西也无法编译。我已经取消选中离线工作,尝试删除/添加 maven 目录,取消注释更多的依赖项,将所有更改为编译而不是实现,但只会给我更多错误。
是的,我已将所有 SDK 更新到最新版本,但我感觉 Gradle 无法从网站下载某些依赖项,这就是我无法下载更多其他依赖项的原因。 (虽然我的离线工作是未勾选的)
此外,无论上面的代码中没有注释什么,这意味着我已经尝试输入这些行,但它没有解决问题,而是产生了更多问题。
这是我找到它的方式,请尝试以下
Go to File->Settings->Build, Execution, Deployment->Gradle->Uncheck Offline work option.
尝试一次,而不是实施编译设计支持gradle代码
compile 'com.android.support:design:26.1.0'
并删除这个
implementation 'com.android.support:design:26.1.0'
我最后意识到的问题是,我在设置android代理时,只设置了1个HTTP代理,没有意识到没有设置HTTPS代理。
所以通过设置 HTTPS 代理解决了这个问题后,就没有问题了。