我在 build.gradle(Module:app) 中添加了以下行:
I added the following line to my build.gradle(Module:app):
compile 'com.android.support:design:25.4.0'
但是在执行 Gradle 时,我得到了
But when executing Gradle I'm getting
Failed to resolve: com.android.support.design:25.4.0
我从 android 支持设计库中获得了支持代码 并将其添加到新项目中.我将它添加到依赖部分,如下所示:
I got that the support code from the android support design library and added it to a new project. I added it to the dependency section as such:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.4.0'
}
关于我做错了什么有什么想法吗?
Any ideas on what I'm doing wrong?
重要提示:现在可以通过 Google 的 Maven 存储库获得支持库.您无需下载支持SDK 管理器中的存储库.有关详细信息,请参阅 支持库设置.
Important: The support libraries are now available through Google's Maven repository. You do not need to download the support repository from the SDK Manager. For more information, see Support Library Setup.
第 1 步:为您的应用打开 build.gradle 文件.
Step 1: Open the build.gradle file for your application.
第 2 步:确保存储库部分包含带有https:/的 maven 部分/maven.google.com"端点.例如:
Step 2: Make sure that the repositories section includes a maven section with the "https://maven.google.com" endpoint. For example:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
第 3 步: 将支持库添加到依赖项部分.例如,要添加 v4 core-utils 库,请添加以下行:
Step 3: Add the support library to the dependencies section. For example, to add the v4 core-utils library, add the following lines:
dependencies {
...
compile "com.android.support:support-core-utils:25.4.0"
}
这篇关于无法解决:com.android.support.design:25.4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!