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

问题描述 投票:6回答:2
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
react-native ubuntu-16.04 react-native-android
2个回答
7
投票

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

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


5
投票

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

enter image description here

enter image description here

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

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

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

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

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.