【问题标题】:react native - error while fetching build tools files反应原生 - 获取构建工具文件时出错
【发布时间】:2018-11-06 21:31:09
【问题描述】:

我无法使用 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

【问题讨论】:

标签: android react-native gradle


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

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

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

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

    【讨论】:

      【解决方案3】:

      对我有用的唯一解决方案是转到 Build --> Build Types,并将 google() 添加到两个 repos

      【讨论】:

        猜你喜欢
        • 2021-12-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-10-21
        • 2018-08-12
        • 1970-01-01
        相关资源
        最近更新 更多