【问题标题】:How to fix error saying "Task :app:installDebug FAILED", while run my react native project in android studio?如何修复错误说“任务:app:installDebug FAILED”,同时在android studio中运行我的react native项目?
【发布时间】:2019-04-20 20:00:25
【问题描述】:

我已经完成了与 react-native doc Linux -> Android 相同的环境设置过程..

当我运行“react-native run-android”时,出现错误提示

任务 :app:installDebug 失败 FAILURE:构建失败并出现异常。

谁能帮我解决这个问题?

这是错误..

azran@Azran:~/Desktop/AwesomeProject2$ react-native run-android
info JS server already running.
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
> Task :app:installDebug FAILED

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 8s
26 actionable tasks: 25 executed, 1 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.

【问题讨论】:

  • com.android.builder.testing.api.DeviceException: No connected devices!:检查您是否启动并运行了模拟器。如果您使用的是设备,请确保设备中启用了开发者模式,并且 PC 可以使用它进行调试。

标签: javascript android react-native android-gradle-plugin


【解决方案1】:

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

此错误清楚地表明未找到可运行该应用的设备。确保您的模拟器正在运行,如果使用物理设备,请确保设备上的开发者模式USB调试已开启

更多信息https://developer.android.com/training/basics/firstapp/running-app

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-22
    • 1970-01-01
    • 2021-05-03
    • 2021-12-11
    相关资源
    最近更新 更多