反应原生 - 在获取构建工具文件时出错

时间:2018-05-28 10:03:32

标签: android react-native gradle

我无法使用react-native run-android构建我的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

3 个答案:

答案 0 :(得分:3)

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

pip install .

答案 1 :(得分:0)

唯一适用于我的解决方案是转到Build-> Build Types,然后在两个存储库中添加 google()

答案 2 :(得分:-2)

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

android {
    //the rest of the code above

    lintOptions {
       disable 'MissingTranslation'
    }
}

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