我似乎无法从命令行获取 Gradle 命令以使用 API 23 Google API 仿真器映像(Google APIs ARM (armeabi-v7a)
) - 我总是得到一个 com.android.ddmlib.ShellCommandUnresponsiveException
.
I can't seem to get Gradle commands from the command line to work with the API 23 Google API emulator image (Google APIs ARM (armeabi-v7a)
) - I always get a com.android.ddmlib.ShellCommandUnresponsiveException
.
重现步骤:
Google APIs ARM (armeabi-v7a)
gradlew installDebug
Google APIs ARM (armeabi-v7a)
gradlew installDebug
from the command line你会看到:
:demo:assembleDebug:demo:installDebug 失败
:demo:assembleDebug :demo:installDebug FAILED
FAILURE:构建失败并出现异常.
FAILURE: Build failed with an exception.
任务:demo:installDebug"执行失败.com.android.builder.testing.api.DeviceException: com.android.ddmlib.ShellCommandUnresponsiveException
Execution failed for task ':demo:installDebug'. com.android.builder.testing.api.DeviceException: com.android.ddmlib.ShellCommandUnresponsiveException
如果你运行 gradlew connectedCheck
你会看到类似的错误:
If you run gradlew connectedCheck
you'll see a similar error:
我可以从 Android Studio (1.4) 安装/运行项目和测试,没有任何问题.
I can install/run the project and tests from Android Studio (1.4) without any problems.
Gradle 命令似乎在命令行的 API 21 Google API 模拟器映像上运行良好.
Gradle commands seem to run fine on the API 21 Google API emulator image from the command line.
以下是 Travis for API 23 Google API 模拟器图像的示例失败:
Here is an example failure on Travis for API 23 Google API emulator image:
https://travis-ci.org/barbeau/android-maps-utils/builds/83233500
...以及使用 API 21 Google API 模拟器映像时成功构建的示例:
...and an example successful build when using the API 21 Google API emulator image:
https://travis-ci.org/barbeau/android-maps-utils/builds/83234555
两个版本之间的唯一区别是 Google API 模拟器 API 级别为 23 与 21:
The only difference between the two builds is the Google API emulator API level of 23 vs. 21:
https://github.com/barbeau/android-maps-utils/commit/a5eecd7e7a4fc899ecd5eaeae6826414fefeae70一个>
编辑
我在此问题上打开了一个 AOSP 问题:
I've opened an AOSP issue here on this problem:
https://code.google.com/p/android/issues/detail?id=190200
简答
Android Gradle 插件的硬编码超时值太低.
Android Gradle Plugin had a hardcoded timeout value that was too low.
Google 在 版本 2.0.0-beta3:
将在 2.0.0-beta3 中.
Will be in 2.0.0-beta3.
那么我们在 build.gradle 中放入什么来设置这个超时值呢?
So what do we put in build.gradle to set this timeout value?
目前它全部附加到 android.adbOptions.timeOutInMs.
Currently it's all attached to android.adbOptions.timeOutInMs.
示例:Google 项目 增加 ADB 超时时间 和 添加 Travis-ci 支持.它有效!.
Sample: Google project Increasing ADB timeout and adding Travis-ci support. It works!.
之前的回复
这是 此处报告的相同问题
阅读 unity3 开发人员的解决方法 关于这里的硬编码和低超时
Read the workaround from the unity3 developer about the hardcoded and low timeout here
和star 问题
你是对的.这不是 Travis-ci 的问题,要重现它,您只需要创建一个 armeabi-v7a 模拟器并尝试通过 gradle 命令在本地安装任何应用程序.
You are right. It's not a Travis-ci issue, to reproduce it, you only need to create an armeabi-v7a emulator and try to install any app locally from gradle command.
更多信息这里,我的答案的更新3
更新:
您可以使用 adb 避免 installVariant
任务和此问题:
You can avoid the installVariant
tasks and this issue using adb:
./gradlew clean
./gradlew assembleDebug
./gradlew assembleDebugAndroidTest
adb install app/build/outputs/apk/app-debug.apk
adb install app/build/outputs/apk/app-debug-androidTest-unaligned.apk
adb shell am instrument -w com.google.samples.apps.topeka.test/android.support.test.runner.AndroidJUnitRunner
有效:
...
:app:assembleDebugAndroidTest
BUILD SUCCESSFUL
Total time: 19.787 secs
2413 KB/s (4204090 bytes in 1.701s)
pkg: /data/local/tmp/app-debug.apk
Success
1984 KB/s (1058902 bytes in 0.521s)
pkg: /data/local/tmp/app-debug-androidTest-unaligned.apk
Success
com.google.samples.apps.topeka.activity.SignInActivityTest:.
com.google.samples.apps.topeka.activity.quiz.EntertainmentQuizTest:.
com.google.samples.apps.topeka.activity.quiz.GeneralKnowledgeQuizTest:..
这篇关于API 23 Google API 仿真器映像 (armeabi-v7a) 上的 Gradle 命令失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!