Android studio default project fails: Error:Failed to resolve: com.android.support:support-v4:25.2.0

强颜欢笑 提交于 2019-11-28 01:25:30

Try this:

  1. in Android Studio, open Tools -> Android -> SDK Manager
  2. under tab "SDK Tools" un-check the libraries causing problems
  3. click "apply" to uninstall them
  4. re-check the same libraries click "apply" to reinstall them
  5. close SDK Manager and run Gradle sync / build

Please be noted that support library from revision 25.4.0 to the latest, we need to add google maven. As in the release note says:

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.

So you need to add the google maven to your root build.gradle like this:

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

Read more at Support Library Setup.

I had the same problem and it was due of an interference with another library.
In my case I had to comment:

compile 'com.onesignal:OneSignal:[3.5.3,4.0.0)

Now it builds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!