加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-15 08:16:44 所属栏目:百科 来源:网络整理
导读:问题 D:rnworkspaceHelloreact-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:checkDebugMani

问题

D:rnworkspaceHello>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:rnworkspaceHelloandroid>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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读