首页 > 解决方案 > 尝试在真实设备上运行 react-native 但 installDebug 发生错误

问题描述

我正在尝试在我的 android 手机上运行 react native,但发生了这个错误。我使用了 react-native-cli。我还没有更改 react-native 提供的代码。请帮助。提前致谢

错误在这里=>

info 运行 jetifier 将库迁移到 AndroidX。您可以使用“--no-jetifier”标志禁用它。Jetifier 找到 967 个文件来转发-jetify。使用 8 名工人...

此版本中使用了已弃用的 Gradle 功能,使其与 Gradle 7.0 不兼容。使用“--warning-mode all”显示各个弃用警告。请参阅https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings

FAILURE:构建失败并出现异常。

3 秒内构建失败

错误 无法安装应用程序。确保您已设置 Android 开发环境:https ://reactnative.dev/docs/getting-started.html#android-development-environment 。使用 --verbose 标志运行 CLI 以获取更多详细信息。错误:命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE:构建失败并出现异常。

3 秒内构建失败

at makeError (C:\Users\Buntu\Documents\projects\Contactapp\node_modules\execa\index.js:174:9)
at C:\Users\Buntu\Documents\projects\Contactapp\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (C:\Users\Buntu\Documents\projects\Contactapp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\Buntu\Documents\projects\Contactapp\node_modules\@react-native-community\cli\build\index.js:186:9)

C:\Users\Buntu\Documents\projects\Contactapp>

标签: androidreactjsreact-nativegradlereact-native-android

解决方案


推荐阅读