首页 > 解决方案 > 启动我的项目时出现 React Native Gradle 问题

问题描述

我使用过 linux mint 并且在启动本机应用程序后收到此消息。我已将我的安卓设备连接到笔记本电脑。我没有使用任何模拟器。

sudo react-native run-android

> Task :app:installDebug FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
26 actionable tasks: 1 executed, 25 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!

* 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 7s

error Failed to install the app. Make sure you have an Android emulator running or a device connected. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!

* 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 7s

    at checkExecSyncError (child_process.js:629:11)
    at execFileSync (child_process.js:647:13)
    at runOnAllDevices (/var/www/html/react/LotteryApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
    at buildAndRun (/var/www/html/react/LotteryApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:137:41)
    at then.result (/var/www/html/react/LotteryApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:103:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)

我已经尝试了很多事情,比如--warning-mode all和其他很多事情。但我仍然收到此错误。我不知道该怎么做。

我正在使用 graddle 版本 5。npm - 6.9.0 节点 - 12.4.0 react-native-cli: 2.0.1 react-native: 0.60.0

我能得到任何关于如何解决这个问题的线索吗?请在这方面提供帮助。提前致谢。

标签: react-native

解决方案


输出告诉您错误是什么:

com.android.builder.testing.api.DeviceException:没有连接设备!

您需要启动 Android 模拟器或连接设备以在其上运行应用程序。


推荐阅读