首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何修复react-native-cli无法安装应用的错误?

如何修复react-native-cli无法安装应用的错误?
EN

Stack Overflow用户
提问于 2020-06-01 12:54:00
回答 2查看 700关注 0票数 0

当我运行react-native run-android时,我遇到了这个错误。我试图将我的java版本降级到8,但仍然不起作用。

运行jetifier将库迁移到AndroidX的信息。您可以使用"--no-jetifier“标志禁用它。Jetifier找到960个要转发jetify的文件。使用8个工人...info JS服务器已在运行。正在安装应用程序的信息...

代码语言:javascript
复制
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)
EN

回答 2

Stack Overflow用户

发布于 2021-05-31 14:00:05

我在这个(“node_modules/execa/index.js”)文件中也遇到了类似的错误。我使用下面给出的两个命令解决了我的错误

代码语言:javascript
复制
npm uninstall -g react-native-cli
代码语言:javascript
复制
yarn global add @react-native-community/cli

如果我的解决方案不起作用,请检查其他解决方案here

票数 0
EN

Stack Overflow用户

发布于 2021-05-31 14:10:03

代码语言:javascript
复制
react-native run-android --variant Huaweidebug 

使用上面的命令运行。它应该修复,但如果存在错误,请在android studio中打开项目

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62125902

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档