第二次执行应用程序React Native时出错



我很难在genymotion中运行我的应用程序。当我第一次运行命令npx react-native startnpx react-native run-android时,我的应用程序工作正常,但是当我安装我在项目中使用的库并再次遵循命令时,控制台显示了一个错误,我尝试从android模拟器卸载应用程序,./gradlew清洁,但没有任何工作。我的环境变量没问题,因为应用程序是在第一次运行时执行的。有人能帮忙吗?请遵循错误:

npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 956 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :app:checkDebugAarMetadata FAILED
7 actionable tasks: 2 executed, 5 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not download material-1.1.0.aar (com.google.android.material:material:1.1.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/android/material/material/1.1.0/material-1.1.0.aar'.
> Read timed out
* 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 4m 37s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not download material-1.1.0.aar (com.google.android.material:material:1.1.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/android/material/material/1.1.0/material-1.1.0.aar'.
> Read timed out
* 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 4m 37s
at makeError (/mnt/hd/www/react-native/projects/tutorial-projects/notas/node_modules/execa/index.js:174:9)
at /mnt/hd/www/react-native/projects/tutorial-projects/notas/node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async runOnAllDevices (/mnt/hd/www/react-native/projects/tutorial-projects/notas/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
at async Command.handleAction (/mnt/hd/www/react-native/projects/tutorial-projects/notas/node_modules/@react-native-community/cli/build/index.js:186:9)
info Run CLI with --verbose flag for more details.

我解决了这个问题。我改变了我的体型。gradle文件。:

ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
ndkVersion = "20.1.5948944"
}

:后

buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "20.1.5948944"
}

最新更新