Could not find com.android.tools.build:gradle:3.3.1

执行react-native run-android报错
FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘testProject’.

Could not resolve all files for configuration ‘:classpath’.
Could not find com.android.tools.build:gradle:3.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
Required by:
project :

这个错是因为更改了gradle版本后 3.0不再是jcenter.bintray.com提供
解决办法:
在repositories{}内添加google()
它会去更换为https://dl.google.com/ 下载
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath ‘com.android.tools.build:gradle:3.0.1’

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects {
repositories {
google()
jcenter()
}
}

猜你喜欢

转载自blog.csdn.net/weixin_44175041/article/details/87805970
今日推荐