无法建立android专案

时间:2019-09-17 20:08:14

标签: android react-native gradle

我正在使用本机反应。我的项目运行良好,但是几个月后,我必须对项目进行一些更改。现在,我正在尝试使用react-native run-android构建项目,它会引发异常。

我搜索了问题,所有解决方案都说编辑build.gradle并在每个存储库之前添加google(),但没有一个对我有用。

例外:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'project'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find gradle.jar (com.android.tools.build:gradle:3.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar
   > Could not find builder.jar (com.android.tools.build:builder:3.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.2.1/builder-3.2.1.jar
   > Could not find tracker.jar (com.android.tools.analytics-library:tracker:26.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/tracker/26.2.1/tracker-26.2.1.jar
   > Could not find shared.jar (com.android.tools.analytics-library:shared:26.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/shared/26.2.1/shared-26.2.1.jar
   > Could not find crash.jar (com.android.tools.analytics-library:crash:26.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.2.1/crash-26.2.1.jar
   > Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.2.1/lint-gradle-api-26.2.1.jar
   > Could not find gradle-api.jar (com.android.tools.build:gradle-api:3.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-api/3.2.1/gradle-api-3.2.1.jar
   > Could not find databinding-compiler-common.jar (androidx.databinding:databinding-compiler-common:3.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler-common/3.2.1/databinding-compiler-common-3.2.1.jar
   > Could not find manifest-merger.jar (com.android.tools.build:manifest-merger:26.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/manifest-merger/26.2.1/manifest-merger-26.2.1.jar
   > Could not find sdk-common.jar (com.android.tools:sdk-common:26.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/sdk-common/26.2.1/sdk-common-26.2.1.jar
   > Could not find builder-test-api.jar (com.android.tools.build:builder-test-api:3.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-test-api/3.2.1/builder-test-api-3.2.1.jar
   > Could not find ddmlib.jar (com.android.tools.ddms:ddmlib:26.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/ddms/ddmlib/26.2.1/ddmlib-26.2.1.jar
   > Could not find sdklib.jar (com.android.tools:sdklib:26.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/sdklib/26.2.1/sdklib-26.2.1.jar
   > Could not find layoutlib-api.jar (com.android.tools.layoutlib:layoutlib-api:26.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/layoutlib/layoutlib-api/26.2.1/layoutlib-api-26.2.1.jar
   > Could not find dvlib.jar (com.android.tools:dvlib:26.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/dvlib/26.2.1/dvlib-26.2.1.jar
   > Could not find repository.jar (com.android.tools:repository:26.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/repository/26.2.1/repository-26.2.1.jar
   > Could not find common.jar (com.android.tools:common:26.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/common/26.2.1/common-26.2.1.jar
   > Could not find jetifier-processor.jar (com.android.tools.build.jetifier:jetifier-processor:1.0.0-alpha10).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/jetifier/jetifier-processor/1.0.0-alpha10/jetifier-processor-1.0.0-alpha10.jar
   > Could not find bundletool.jar (com.android.tools.build:bundletool:0.5.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/0.5.0/bundletool-0.5.0.jar
   > Could not find jetifier-core.jar (com.android.tools.build.jetifier:jetifier-core:1.0.0-alpha10).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/jetifier/jetifier-core/1.0.0-alpha10/jetifier-core-1.0.0-alpha10.jar
   > Could not find builder-model.jar (com.android.tools.build:builder-model:3.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-model/3.2.1/builder-model-3.2.1.jar
   > Could not find protos.jar (com.android.tools.analytics-library:protos:26.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/26.2.1/protos-26.2.1.jar
   > Could not find apkzlib.jar (com.android.tools.build:apkzlib:3.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/apkzlib/3.2.1/apkzlib-3.2.1.jar
   > Could not find apksig.jar (com.android.tools.build:apksig:3.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/apksig/3.2.1/apksig-3.2.1.jar
   > Could not find annotations.jar (com.android.tools:annotations:26.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/annotations/26.2.1/annotations-26.2.1.jar
   > Could not find databinding-common.jar (androidx.databinding:databinding-common:3.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-common/3.2.1/databinding-common-3.2.1.jar
   > Could not find baseLibrary.jar (com.android.databinding:baseLibrary:3.2.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/databinding/baseLibrary/3.2.1/baseLibrary-3.2.1.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html

Command failed: gradlew.bat installDebug

Error: Command failed: gradlew.bat installDebug
    at checkExecSyncError (child_process.js:616:11)
    at Object.execFileSync (child_process.js:634:13)
    at runOnAllDevices (F:\clone\Remote_Device_Controller\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
    at buildAndRun (F:\clone\Remote_Device_Controller\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
    at isPackagerRunning.then.result (F:\clone\Remote_Device_Controller\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)

build.gradle存储库:

buildscript {
    ext {
        buildToolsVersion = "28.0.2"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 27
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'

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

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

任何人都知道,自上次成功构建项目以来,我什至没有碰过一条线时,我的项目发生了什么事?

顺便说一句,很奇怪,无法找到显示该链接的链接,它正常工作,我将其复制并粘贴到了浏览器中。它可以手动下载

0 个答案:

没有答案