当运行npx react-native run-android时,得到构建失败的结果。错误
配置根项目'AwesomeProject'时出现问题,无法解析配置':classpath'的所有构件,无法下载protobuf-java-3.4.0.jar(com.google.protobuf:protobuf-java:3.4.0)。 无法下载protobuf-java-3.4.0.jar (com.google.protobuf:protobuf-java:3.4.0) 无法获取资源':classpath'。https:/jcenter.bintray.comcomgoogleprotobufprotobuf-java3.4.0protobuf-java-3.4.0.jar。'.
下面是我的build.gradle文件
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
解决了,这是由于一些网络问题,我无法访问仓库。