当我运行react-native run-android时,我会遇到此错误。 我试图将Java版本降级到8,但仍然无法正常工作。
info运行jetifier将库迁移到AndroidX。您可以使用“ --no-jetifier”标志禁用它。 Jetifier发现有960个文件需要正向喷射。使用8名工人... 信息JS服务器已在运行。 信息正在安装应用程序...
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build failed with an exception.
* What went wrong:
Task 'installDebug' not found in project ':app'.
* Try:
Run gradlew tasks to get a list of available tasks. 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
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Task 'installDebug' not found in project ':app'.
* Try:
Run gradlew tasks to get a list of available tasks. 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
at makeError (D:\freelance\SuperDaily\node_modules\execa\index.js:174:9)
at D:\freelance\SuperDaily\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async runOnAllDevices (D:\freelance\SuperDaily\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (D:\freelance\SuperDaily\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:186:9)
答案 0 :(得分:0)
这个(“node_modules/execa/index.js”)文件也有类似的错误。 我使用下面给出的 2 个命令解决了我的错误
npm uninstall -g react-native-cli
yarn global add @react-native-community/cli
如果我的解决方案不起作用,请检查其他一些解决方案here
答案 1 :(得分:0)
react-native run-android --variant Huaweidebug
使用上述命令运行。 它应该修复,但如果存在错误,则在 android studio 中打开项目