Android Failed to resolve compile support library解决办法

今天在工程添加ExoPlayer依赖时,报出错误“failed to resolve compile 'com.android.support:support-core-utils:25.4.0'”,显然是找不到这个依赖了,但是本地SDK也不能更新这个支持库,Google一番发现是Google不支持通过SDK的更新来更新support库了,而是通过maven仓库来下载支持库。原文是这么写的

The support libraries are now available through Google's Maven repository. We no longer support downloading the libraries through the SDK Manager, and that functionality will be removed soon.

那么具体的添加步骤也很简单,跟其他依赖库相同。
1.在应用的build.gradle文件中添加Google的Maven仓库地址

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

2.在Module的build.gradle文件中添加依赖引用

dependencies {
    ...
    compile "com.android.support:support-core-utils:25.4.0"
}

Google关于support库引用方式的官方链接:https://developer.android.com/topic/libraries/support-library/setup.html
stackoverflow上也有类似的问题:https://stackoverflow.com/questions/44691858/failed-to-resolve-com-android-support-design25-4-0

你可能感兴趣的:(Android Failed to resolve compile support library解决办法)