react-native run-android 运行出错 No connected devices!

前端之家收集整理的这篇文章主要介绍了react-native run-android 运行出错 No connected devices!前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

问题

D:\rnworkspace\Hello>react-native run-android

JS server already running.
Building and installing the app on the device (cd android && gradlew.bat install
Debug)...
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42321Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee0110Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore0110Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineBase0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp30110Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0392Library UP-TO-DATE
:app:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
:app:validateDebugSigning
:app:packageDebug
:app:zipalignDebug
:app:assembleDebug
: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.


BUILD Failed


Total time: 23.398 secs
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/android-setup.html



(node:6824) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec

tion id: 2): TypeError: Cannot read property 'message' of undefined


问题分析

1.用 gradlew compileDebug --stacktrace 编译调试命令进行调试,显示如下:
D:\rnworkspace\Hello\android>gradlew compileDebug --stacktrace


FAILURE: Build Failed with an exception.


* What went wrong:
Task 'compileDebug' is ambiguous in root project 'Hello'. Candidates are: 'compi
leDebugAidl','compileDebugAndroidTestAidl','compileDebugAndroidTestJavaWithJav
ac','compileDebugAndroidTestNdk','compileDebugAndroidTestRenderscript','compi
leDebugAndroidTestSources','compileDebugJavaWithJavac','compileDebugNdk','com
pileDebugRenderscript','compileDebugSources','compileDebugUnitTestJavaWithJava
c','compileDebugUnitTestSources'.


* Try:
Run gradlew tasks to get a list of available tasks. Run with --info or --debug o
ption to get more log output.


* Exception is:
org.gradle.execution.TaskSelectionException: Task 'compileDebug' is ambiguous in
root project 'Hello'. Candidates are: 'compileDebugAidl','compileDebugAndroidT
estAidl','compileDebugAndroidTestJavaWithJavac',
'compileDebugAndroidTestRenderscript','compileDebugAndroidTestSources','compil
eDebugJavaWithJavac','compileDebugRenderscript','compileDeb
ugSources','compileDebugUnitTestJavaWithJavac','compileDebugUnitTestSources'.
at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:100)

解决

1.启动AVD
原文链接:https://www.f2er.com/react/305258.html

猜你在找的React相关文章