Gradle 命令在 API 23 Google API 模拟器图像 (armeabi-v7a) 上失败
Gradle commands fail on API 23 Google API emulator image (armeabi-v7a)
我似乎无法从命令行获得 Gradle 命令来使用 API 23 Google API 模拟器图像 (Google APIs ARM (armeabi-v7a)
) - 我总是得到 com.android.ddmlib.ShellCommandUnresponsiveException
.
重现步骤:
- 创建 AVD API 23
Google APIs ARM (armeabi-v7a)
- 克隆 https://github.com/googlemaps/android-maps-utils(或使用您自己的项目)
- 运行
gradlew installDebug
来自命令行
你会看到:
:demo:assembleDebug
:demo:installDebug FAILED
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':demo:installDebug'.
com.android.builder.testing.api.DeviceException: com.android.ddmlib.ShellCommandUnresponsiveException
如果你 运行 gradlew connectedCheck
你会看到类似的错误:
- What went wrong:
Execution failed for task ':library:connectedDebugAndroidTest'.
com.android.builder.testing.api.TestException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.ShellCommandUnresponsiveException
我可以 install/run 从Android Studio (1.4) 进行的项目和测试没有任何问题。
Gradle 命令在 API 21 Google API 模拟器图像上似乎 运行 正常命令行。
这是 Travis 上 API 23 Google API 模拟器图像失败的示例:
https://travis-ci.org/barbeau/android-maps-utils/builds/83233500
...以及使用 API 21 Google API 模拟器图像时成功构建的示例:
https://travis-ci.org/barbeau/android-maps-utils/builds/83234555
两个版本之间的唯一区别是 Google API 模拟器 API 级别 23 与 21:
https://github.com/barbeau/android-maps-utils/commit/a5eecd7e7a4fc899ecd5eaeae6826414fefeae70
编辑
我已经在此处针对此问题打开了一个 AOSP 问题:
简答
Android Gradle 插件的硬编码超时值太低。
Google 在 version 2.0.0-beta3:
中修复了它
Will be in 2.0.0-beta3.
So what do we put in build.gradle to set this timeout value?
Currently it's all attached to android.adbOptions.timeOutInMs.
示例:Google 项目 Increasing ADB timeout and adding Travis-ci support. It works!.
上一个回复
这是same issue that has been reported here
在此处阅读有关硬编码和低超时的 workaround from the unity3 developer
你是对的。这不是 Travis-ci 问题,要重现它,您只需要创建一个 armeabi-v7a 模拟器并尝试从 gradle 命令在本地安装任何应用程序。
更多信息
更新:
您可以使用 adb 避免 installVariant
任务和此问题:
./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:..
我似乎无法从命令行获得 Gradle 命令来使用 API 23 Google API 模拟器图像 (Google APIs ARM (armeabi-v7a)
) - 我总是得到 com.android.ddmlib.ShellCommandUnresponsiveException
.
重现步骤:
- 创建 AVD API 23
Google APIs ARM (armeabi-v7a)
- 克隆 https://github.com/googlemaps/android-maps-utils(或使用您自己的项目)
- 运行
gradlew installDebug
来自命令行
你会看到:
:demo:assembleDebug :demo:installDebug FAILED
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':demo:installDebug'. com.android.builder.testing.api.DeviceException: com.android.ddmlib.ShellCommandUnresponsiveException
如果你 运行 gradlew connectedCheck
你会看到类似的错误:
- What went wrong: Execution failed for task ':library:connectedDebugAndroidTest'. com.android.builder.testing.api.TestException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.ShellCommandUnresponsiveException
我可以 install/run 从Android Studio (1.4) 进行的项目和测试没有任何问题。
Gradle 命令在 API 21 Google API 模拟器图像上似乎 运行 正常命令行。
这是 Travis 上 API 23 Google API 模拟器图像失败的示例:
https://travis-ci.org/barbeau/android-maps-utils/builds/83233500
...以及使用 API 21 Google API 模拟器图像时成功构建的示例:
https://travis-ci.org/barbeau/android-maps-utils/builds/83234555
两个版本之间的唯一区别是 Google API 模拟器 API 级别 23 与 21:
https://github.com/barbeau/android-maps-utils/commit/a5eecd7e7a4fc899ecd5eaeae6826414fefeae70
编辑
我已经在此处针对此问题打开了一个 AOSP 问题:
简答
Android Gradle 插件的硬编码超时值太低。
Google 在 version 2.0.0-beta3:
中修复了它Will be in 2.0.0-beta3.
So what do we put in build.gradle to set this timeout value?
Currently it's all attached to android.adbOptions.timeOutInMs.
示例:Google 项目 Increasing ADB timeout and adding Travis-ci support. It works!.
上一个回复
这是same issue that has been reported here
在此处阅读有关硬编码和低超时的 workaround from the unity3 developer
你是对的。这不是 Travis-ci 问题,要重现它,您只需要创建一个 armeabi-v7a 模拟器并尝试从 gradle 命令在本地安装任何应用程序。
更多信息
更新:
您可以使用 adb 避免 installVariant
任务和此问题:
./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:..