問題描述
我在 build.gradle(Module:app) 中添加了以下行:
I added the following line to my build.gradle(Module:app):
compile 'com.android.support:design:25.4.0'
但是在執(zhí)行 Gradle 時(shí),我得到了
But when executing Gradle I'm getting
Failed to resolve: com.android.support.design:25.4.0
我從 android 支持設(shè)計(jì)庫中獲得了支持代碼 并將其添加到新項(xiàng)目中.我將它添加到依賴部分,如下所示:
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'
}
關(guān)于我做錯(cuò)了什么有什么想法嗎?
Any ideas on what I'm doing wrong?
推薦答案
重要提示:現(xiàn)在可以通過 Google 的 Maven 存儲(chǔ)庫獲得支持庫.您無需下載支持SDK 管理器中的存儲(chǔ)庫.有關(guān)詳細(xì)信息,請(qǐng)參閱 支持庫設(shè)置.
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 步:為您的應(yīng)用打開 build.gradle 文件.
Step 1: Open the build.gradle file for your application.
第 2 步:確保存儲(chǔ)庫部分包含帶有https:/的 maven 部分/maven.google.com"端點(diǎn).例如:
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 步: 將支持庫添加到依賴項(xiàng)部分.例如,要添加 v4 core-utils 庫,請(qǐng)?zhí)砑右韵滦?
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"
}
這篇關(guān)于無法解決:com.android.support.design:25.4.0的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!