首页 > 解决方案 > react-native run-android 命令无法解析配置“:classpath”的所有工件

问题描述

尝试运行 react-native run-android gradle 时无法解析所有配置:classpath。

react-native run-android
info JS server already running.
info Building and installing the app on the device (cd android && gradlew.bat app: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 resolve com.android.tools.build:gradle:3.3.1.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.3.1.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
               > Connect to dl.google.com:443 [dl.google.com/172.217.21.238] failed: Connection timed out: connect
      > Could not resolve com.android.tools.build:gradle:3.3.1.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
               > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/18.195.111.75, jcenter.bintray.com/35.156.75.35] failed: Connection timed out: connect

* 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 1m 4s
error 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
error Command failed: gradlew.bat app:installDebug

我已经尝试了所有可以找到的解决方案,例如将 google() 添加到 allProjects 存储库等。

标签: androidreact-native

解决方案


推荐阅读