本文介绍了com.android.builder.testing.api.DeviceException:没有连接的设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

扫描文件夹中的符号链接/home/sino/Desktop/we-clone/node_modules (4ms)正在启动 JS 服务器...在设备上构建和安装应用程序 (cd android && ./gradlew installDebug)...增量 Java 编译是一个孵化功能.:app:preBuild 最新:app:preDebugBuild 最新:app:checkDebugManifest:app:preReleaseBuild 最新版本:app:prepareComAndroidSupportAppcompatV72301库更新:app:prepareComAndroidSupportSupportV42301Library 最新:app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library 最新:app:prepareComFacebookFrescoDrawee130Library 最新:app:prepareComFacebookFrescoFbcore130Library 最新:app:prepareComFacebookFrescoFresco130Library 最新:app:prepareComFacebookFrescoImagepipeline130Library 最新:app:prepareComFacebookFrescoImagepipelineBase130Library 最新:app:prepareComFacebookFrescoImagepipelineOkhttp3130Library 最新:app:prepareComFacebookReactReactNative0493Library 最新:app:prepareComFacebookSoloaderSoloader010Library 最新:app:prepareOrgWebkitAndroidJscR174650Library 最新:app:prepareDebugDependencies:app:compileDebugAidl 最新:app:compileDebugRenderscript 最新:app:generateDebugBuildConfig 最新:app:mergeDebugShaders 最新:app:compileDebugShaders 最新:app:generateDebugAssets 最新:app:mergeDebugAssets 最新:app:generateDebugResValues 最新:app:generateDebugResources 最新:app:mergeDebugResources 最新:app:bundleDebugJsAndAssets 跳过:app:processDebugManifest 最新:app:processDebugResources 最新:app:generateDebugSources 最新:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE:app:compileDebugJavaWithJavac 最新:app:compileDebugNdk 最新:app:compileDebugSources 最新:app:transformClassesWithDexForDebug 最新:app:mergeDebugJniLibFolders 最新:app:transformNative_libsWithMergeJniLibsForDebug 最新:app:processDebugJavaRes 最新:app:transformResourcesWithMergeJavaResForDebug 最新:app:validateSigningDebug:app:packageDebug 最新:app:assembleDebug 最新:应用:安装调试07:52:34 E/adb:*守护进程没有运行;现在从 tcp:5037 开始07:52:37 E/adb: * 守护进程成功启动:app:installDebug 失败FAILURE:构建失败,出现异常.* 什么地方出了错:任务:app:installDebug"执行失败.>com.android.builder.testing.api.DeviceException:没有连接的设备!* 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪.使用 --info 或 --debug 选项运行以获得更多日志输出.构建失败总时间:8.916 秒无法在设备上安装该应用程序,请阅读上面的错误以了解详细信息.确保您有一个正在运行的 Android 模拟器或已连接的设备设置你的 Android 开发环境:https://facebook.github.io/react-native/docs/android-setup.html
解决方案

如果你已经安装了 android studio(如果没有安装)启动 android studio 和一个虚拟项目,去 Tools -> AVD Manager.确保您创建了一个虚拟设备并启动它.

注意:要创建此虚拟设备,您需要先在其上下载并安装兼容的操作系统(与您项目的 Android SDK 版本兼容 - SDK 版本可以在 build.gradle 文件中找到)发射.AVD 经理将指导您完成整个过程.

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

如果使用原生 Android,请转到设置 > 关于手机 > 版本号.在三星 Galaxy 设备上,转至设置 > 关于设备 > 构建数字.在 HTC 设备上,转至设置 > 关于 > 软件信息 > 更多 > 内部版本号.在 LG 设备上,转到设置 >关于手机 > 软件信息 > 版本号.点击内部版本七次.轻点几下后,您应该会看到步数计数直到您解锁开发人员选项.激活后,您将看到一条消息,上面写着您现在是一名开发人员!"回到设置,您可以在菜单中找到开发人员选项条目.(

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
解决方案

If you have android studio installed(if not install it) launch android studio with a dummy project, go to Tools -> AVD Manager. Make sure that you create a virtual device and start it.

Note: To create this virtual device you will need to download and install a compatible OS (compatible with your project's Android SDK version - SDK version can be found inside build.gradle file) on it before launching. AVD Manager will guide you with the process.

Another thing, you may be using a real Android device not an emulator and still get this message. If your device is connected through USB to your laptop you need to first enable the developer options:

Then inside developer options, you should enable USB debugging.

这篇关于com.android.builder.testing.api.DeviceException:没有连接的设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 17:25