gpt4 book ai didi

android - react-native run-android,无法解析配置 ':classpath' 的所有 Artifact

转载 作者:行者123 更新时间:2023-12-04 23:46:22 25 4
gpt4 key购买 nike

我遵循了React Native Getting Started的指示,在“使用 native 代码构建项目”选项卡中,适用于 Windows 和 Android。

这是\AwesomeProject\android\build.gradle 的内容,之后我执行时出现错误:react-native run-android

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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.0.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"
}
}
}


task wrapper(type: Wrapper) {
gradleVersion = '4.7'
distributionUrl = distributionUrl.replace("bin", "all")
}

当我执行:react-native run-android 时,我得到以下错误输出:
D:\studio\study\reactnatv\AwesomeProject>react-native run-android
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'AwesomeProject'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:3.0.1.
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
Required by:
project :

* 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 (D:\studio\study\reactnatv\AwesomeProject\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
at buildAndRun (D:\studio\study\reactnatv\AwesomeProject\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
at isPackagerRunning.then.result (D:\studio\study\reactnatv\AwesomeProject\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
at process._tickCallback (internal/process/next_tick.js:68:7)


D:\studio\study\reactnatv\AwesomeProject>

我检查了这个 US sanctions solution但它没有奏效。

我究竟做错了什么 ?

最佳答案

您必须在项目中更改此行:

dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
}

关于android - react-native run-android,无法解析配置 ':classpath' 的所有 Artifact ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55027644/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com