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

kh *_*eep 8 react-native ubuntu-16.04 react-native-android

Scanning folders for symlinks in /home/sino/Desktop/we-clone/node_modules (4ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee130Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore130Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco130Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline130Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineBase130Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp3130Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0493Library 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:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders 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:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:transformClassesWithDexForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateSigningDebug
:app:packageDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
:app:installDebug
07:52:34 E/adb: * daemon not running; starting now at tcp:5037
07:52:37 E/adb: * daemon started successfully
: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: 8.916 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
Run Code Online (Sandbox Code Playgroud)

Sof*_*ory 12

如果您安装了android studio(如果未安装),请使用虚拟项目启动android studio,请转到工具-> AVD管理器。确保创建一个虚拟设备并启动它。

在此处输入图片说明

在此处输入图片说明

注意:要创建此虚拟设备,您需要在启动之前下载并安装兼容的OS(与项目的Android SDK版本兼容-SDK版本可以在build.gradle文件中找到)。AVD Manager将指导您进行此过程。

另一件事,您可能使用的是真正的Android设备而不是模拟器,但仍然收到此消息。如果您的设备通过USB连接到笔记本电脑,则需要先启用开发者选项:

如果使用的是普通Android手机,请转到“设置”>“关于手机”>“内部版本号”。在Samsung Galaxy设备上,转到设置>关于设备>内部版本号。在HTC设备上,依次转到设置>关于>软件信息>更多>内部版本号。在LG设备上,依次转到设置>关于手机>软件信息>内部版本号。点击内部版本号七次。轻按前几下后,您应该看到倒数的步骤,直到解锁开发人员选项为止。一旦激活,您将看到一条消息,写着“您现在是开发人员!”,回到“设置”,您将在菜单中找到“开发人员”选项条目。(https://www.digitaltrends.com/mobile/how-to-get-developer-options-on-android/

然后,在开发人员选项中,您应该启用USB调试

在此处输入图片说明


小智 9

您需要运行Android Emulator或连接物理设备并在USB调试模式下运行.

有关更多信息,请参阅https://facebook.github.io/react-native/docs/getting-started.html#preparing-the-android-device.