获取构建工具文件时出错



我无法使用react-native run-android构建我的安卓应用程序,因为我收到以下错误。昨天一切正常。你知道问题可能出在哪里吗?

A problem occurred configuring root project 'contacto'.
> Could not resolve all files for configuration ':classpath'.
> Could not find builder.jar (com.android.tools.build:builder:3.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/builder/3.1.2/builder-3.1.2.jar
> Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar
> Could not find manifest-merger.jar (com.android.tools.build:manifest-merger:26.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/manifest-merger/26.1.2/manifest-merger-26.1.2.jar
> Could not find builder-test-api.jar (com.android.tools.build:builder-test-api:3.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/builder-test-api/3.1.2/builder-test-api-3.1.2.jar
> Could not find aapt2-proto.jar (com.android.tools.build:aapt2-proto:0.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/aapt2-proto/0.1.0/aapt2-proto-0.1.0.jar
> Could not find builder-model.jar (com.android.tools.build:builder-model:3.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/builder-model/3.1.2/builder-model-3.1.2.jar
> Could not find annotations.jar (com.android.tools:annotations:26.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/annotations/26.1.2/annotations-26.1.2.jar

在项目的 gradle 文件中添加以下行

allprojects {
repositories {
.....
......
maven { url 'https://maven.google.com' }  //  Add this line.
......
} }

唯一对我有用的解决方案是转到构建 --> 构建类型,并将google((添加到两个存储库中

对于那些有相同错误的人,请尝试将其添加到App Builde.gradle:

android {
//the rest of the code above
lintOptions {
disable 'MissingTranslation'
}
}

我有同样的问题,无论出于何种原因,这对我都有效。

最新更新