无法解决:com.android.support.design:25.4.0

Failed to resolve: com.android.support.design:25.4.0(无法解决:com.android.support.design:25.4.0)
本文介绍了无法解决:com.android.support.design:25.4.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我在 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Android release APK crash with java.lang.AssertionError: impossible in java.lang.Enum(Android 发布 APK 因 java.lang.AssertionError 崩溃:在 java.lang.Enum 中不可能)
Finished with Non Zero Exit Value 3(以非零退出值 3 结束)
On gradle:3.0.0 More than one file was found with OS independent path #39;META-INF/ASL2.0#39;(在 gradle:3.0.0 上找到多个文件,其独立于操作系统的路径为“META-INF/ASL2.0)
Android : app loading library at runtime on Lollipop but not IceCreamSandwich(Android:运行时在 Lollipop 上而不是 IceCreamSandwich 上的应用程序加载库)
buildConfigField depending on flavor + buildType(buildConfigField 取决于风味 + buildType)
How do I suppress warnings when compiling an android library with gradle?(使用 gradle 编译 android 库时如何抑制警告?)