我正在尝试运行一个没有窗口和启动动画的 AVD,以便在使用 Bitbucket 的管道工作流程中进行仪器测试。我正在使用 Docker image 和使用 Linux Ubuntu 的 Android SDK。
安装程序有效并成功创建了 AVD,但是启动时出现错误,因为它要求硬件加速。
脚本
+ emulator -avd EMU -no-window -no-audio -no-boot-anim & ./gradlew connectedAndroidTest mergeAndroidReports --continue
错误
WARNING | Crash annotation is very large (17292), only 16384 bytes will be recorded, 908 bytes are lost.
INFO | Storing crashdata in: /tmp/android-unknown/emu-crash-34.1.20.db, detection is enabled for process: 378
INFO | Android emulator version 34.1.20.0 (build_id 11610631) (CL:N/A)
INFO | Found systemPath /opt/android-sdk-linux/system-images/android-34/google_apis_playstore/x86_64/
WARNING | Crash annotation is very large (17651), only 16384 bytes will be recorded, 1267 bytes are lost.
WARNING | File System is not ext4, disable QuickbootFileBacked feature
Downloading https://services.gradle.org/distributions/gradle-8.4-bin.zip
ERROR | x86_64 emulation currently requires hardware acceleration!
CPU acceleration status: KVM requires a CPU that supports vmx or svm
More info on configuring VM acceleration on Linux:
https://developer.android.com/studio/run/emulator-acceleration#vm-linux
General information on acceleration: https://developer.android.com/studio/run/emulator-acceleration.
INFO | Storing crashdata in: /tmp/android-unknown/emu-crash-34.1.20.db, detection is enabled for process: 378
INFO | Duplicate loglines will be removed, if you wish to see each individual line launch with the -log-nofilter flag.
INFO | Increasing RAM size to 2048MB
[1]: https://github.com/mindrunner/docker-android-sdk
基于这个SOanswer,我可能可以使用ARM作为最后的手段,即使它很慢,因为它不需要硬件加速,所以我使用
system-images;android-23;google_apis;armeabi-v7a
我将脚本更改为在运行 gradlew 之前等待 adb
+ emulator -avd EMU -memory 2048 -cache-size 1000 -partition-size 6144 -wipe-data -no-window -no-audio -no-boot-anim & adb wait-for-device
+ ./gradlew connectedAndroidTest mergeAndroidReports --continue
模拟器启动
* daemon not running; starting now at tcp:5037
WARNING | Crash annotation is very large (17355), only 16384 bytes will be recorded, 971 bytes are lost.
INFO | Storing crashdata in: /tmp/android-unknown/emu-crash-34.1.20.db, detection is enabled for process: 380
INFO | Android emulator version 34.1.20.0 (build_id 11610631) (CL:N/A)
INFO | Found systemPath /opt/android-sdk-linux/system-images/android-23/google_apis/armeabi-v7a/
WARNING | Crash annotation is very large (17713), only 16384 bytes will be recorded, 1329 bytes are lost.
WARNING | File System is not ext4, disable QuickbootFileBacked feature
WARNING | encryption is off
WARNING | FeatureControl is requesting a non existing feature.
WARNING | Your GPU drivers may have a bug. Switching to software rendering.
WARNING: cannnot unmap ptr 0x7efff4664000 as it is in the protected range from 0x7efff4664000 to 0x7f0074864000
WARNING: cannnot unmap ptr 0x7f0074801000 as it is in the protected range from 0x7efff4664000 to 0x7f0074864000
WARNING | Using fallback path for the emulator registration directory.
WARNING | The emulator now requires a signed jwt token for gRPC access! Use the -grpc flag if you really want an open unprotected grpc port
WARNING | *** Basic token auth should only be used by android-studio ***
WARNING | Using fallback path for the emulator registration directory.
INFO | Storing crashdata in: /tmp/android-unknown/emu-crash-34.1.20.db, detection is enabled for process: 380
INFO | Duplicate loglines will be removed, if you wish to see each individual line launch with the -log-nofilter flag.
library_mode swangle_indirect gpu mode swangle_indirect
Initializing hardware OpenGLES emulation supportandroid_startOpenglesRenderer: gpu infoI0429 22:07:24.206154 380 HealthMonitor.cpp:279] HealthMonitor disabled.
I0429 22:07:24.220783 380 FrameBuffer.cpp:486] Graphics Adapter Vendor Google (Google Inc.)
I0429 22:07:24.220791 380 FrameBuffer.cpp:487] Graphics Adapter Android Emulator OpenGL ES Translator (Google SwiftShader)
I0429 22:07:24.220793 380 FrameBuffer.cpp:488] Graphics API Version OpenGL ES 3.0 (OpenGL ES 3.0 SwiftShader 4.0.0.1)
I0429 22:07:24.220794 380 FrameBuffer.cpp:489] Graphics API Extensions GL_OES_EGL_sync GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_float_linear GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_packed_depth_stencil GL_OES_vertex_half_float GL_OES_standard_derivatives GL_OES_texture_npot GL_OES_rgb8_rgba8 GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_texture_format_BGRA8888 GL_APPLE_texture_format_BGRA8888
I0429 22:07:24.220795 380 FrameBuffer.cpp:490] Graphics Device Extensions N/A
OpenGL Vendor=[Google (Google Inc.)]OpenGL Renderer=[Android Emulator OpenGL ES Translator (Google SwiftShader)]OpenGL Version=[OpenGL ES 3.0 (OpenGL ES 3.0 SwiftShader 4.0.0.1)]INFO | Using security allow list from: /opt/android-sdk-linux/emulator/lib/emulator_access.json
INFO | The active JSON Web Key Sets can be found here: /opt/android-sdk-linux/.android/avd/running/380/jwks/c028d3c2-fd10-428d-adea-ca35206b1f07/active.jwk
INFO | Scanning /opt/android-sdk-linux/.android/avd/running/380/jwks/c028d3c2-fd10-428d-adea-ca35206b1f07 for jwk keys.
INFO | Started GRPC server at 127.0.0.1:8554, security: Local, auth: +token
INFO | Advertising in: /opt/android-sdk-linux/.android/avd/running/pid_380.ini
I0429 22:07:24.334844 430 FrameBuffer.cpp:3707] setDisplayConfigs w 320 h 640 dpiX 160 dpiY 160
I0429 22:07:24.334870 430 FrameBuffer.cpp:3720] setDisplayActiveConfig 0
INFO | Loading snapshot 'default_boot'...
WARNING | Failed to process .ini file /opt/android-sdk-linux/.android/emu-update-last-check.ini for reading.
WARNING | Device 'userdata' does not have the requested snapshot 'default_boot'
WARNING | Failed to load snapshot 'default_boot'
WARNING | Cold boot based on user configuration
INFO | Cold boot based on user configuration
WARNING | Failed to process .ini file /opt/android-sdk-linux/.android/emu-update-last-check.ini for reading.
* daemon started successfully
仪器测试开始,但随后我在安装中遇到错误,因为模拟器似乎没有响应。
Welcome to Gradle 8.4!
Here are the highlights of this release:
- Compiling and testing with Java 21
- Faster Java compilation on Windows
- Role focused dependency configurations creation
For more details see https://docs.gradle.org/8.4/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :app
The Jacoco plugin extension version '0.8.9' is not currently available in the Android Gradle Plugin. Setting the version to 0.8.8
The Jacoco plugin extension version '0.8.9' is not currently available in the Android Gradle Plugin. Setting the version to 0.8.8
The Jacoco plugin extension version '0.8.9' is not currently available in the Android Gradle Plugin. Setting the version to 0.8.8
> Configure project :app:libs:AndroidCommon
The Jacoco plugin extension version '0.8.9' is not currently available in the Android Gradle Plugin. Setting the version to 0.8.8
The Jacoco plugin extension version '0.8.9' is not currently available in the Android Gradle Plugin. Setting the version to 0.8.8
The Jacoco plugin extension version '0.8.9' is not currently available in the Android Gradle Plugin. Setting the version to 0.8.8
> Task :app:libs:AndroidCommon:preBuild UP-TO-DATE
> Task :app:libs:AndroidFirebase:preBuild UP-TO-DATE
... more tasks here
> Task :app:libs:AndroidCommon:connectedDebugAndroidTest
additionalTestOutput is not supported on this device running API level 23 because the additional test output directory could not be found
> Task :app:libs:AndroidMaterial:mergeDebugAndroidTestGlobalSynthetics
> Task :app:processDebugAndroidTestJavaRes
... more tasks here
> Task :app:libs:AndroidCommon:connectedDebugAndroidTest
Exception thrown during onBeforeAll invocation of plugin AndroidTestApkInstallerPlugin: ErrorName: UNKNOWN
NameSpace: DdmlibAndroidDeviceController
ErrorCode: 1
ErrorType: TEST
Message: Failed to install split APK(s): [/opt/atlassian/pipelines/agent/build/app/libs/AndroidCommon/build/outputs/apk/androidTest/debug/AndroidCommon-debug-androidTest.apk]
Failed to install split APK(s): [/opt/atlassian/pipelines/agent/build/app/libs/AndroidCommon/build/outputs/apk/androidTest/debug/AndroidCommon-debug-androidTest.apk]
Unknown platform error occurred when running the UTP test suite. Please check logs for details.
com.android.ddmlib.ShellCommandUnresponsiveException
at com.android.ddmlib.internal.DeviceImpl.lambda$executeRemoteCommand$20(DeviceImpl.java:892)
at com.android.ddmlib.internal.DeviceImpl.logRun1(DeviceImpl.java:1802)
at com.android.ddmlib.internal.DeviceImpl.executeRemoteCommand(DeviceImpl.java:756)
at com.android.ddmlib.SplitApkInstallerBase.installCommit(SplitApkInstallerBase.java:137)
at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:85)
at com.android.ddmlib.IDeviceSharedImpl.installPackages(IDeviceSharedImpl.java:395)
at com.android.ddmlib.internal.DeviceImpl.lambda$installPackages$36(DeviceImpl.java:1492)
at com.android.ddmlib.internal.DeviceImpl.logRun3(DeviceImpl.java:1834)
at com.android.ddmlib.internal.DeviceImpl.installPackages(DeviceImpl.java:1489)
at com.android.ddmlib.internal.DeviceImpl.lambda$installPackages$37(DeviceImpl.java:1504)
at com.android.ddmlib.internal.DeviceImpl.logRun3(DeviceImpl.java:1834)
at com.android.ddmlib.internal.DeviceImpl.installPackages(DeviceImpl.java:1500)
at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDevice.installPackages(DdmlibAndroidDevice.kt:74)
at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDeviceController$executeAsync$deferred$1.invokeSuspend(DdmlibAndroidDeviceController.kt:254)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
> Task :app:libs:AndroidMaterial:mergeDebugAndroidTestJavaResource
> Task :app:libs:AndroidMaterial:checkDebugAndroidTestDuplicateClasses
... more tasks here
> Task :app:connectedDebugAndroidTest
> Task :app:libs:AndroidCommon:connectedDebugAndroidTest
Exception thrown during onBeforeAll invocation of plugin AndroidTestApkInstallerPlugin: ErrorName: UNKNOWN
NameSpace: DdmlibAndroidDeviceController
ErrorCode: 1
ErrorType: TEST
Message: Failed to install split APK(s): [/opt/atlassian/pipelines/agent/build/app/libs/AndroidCommon/build/outputs/apk/androidTest/debug/AndroidCommon-debug-androidTest.apk]
Failed to install split APK(s): [/opt/atlassian/pipelines/agent/build/app/libs/AndroidCommon/build/outputs/apk/androidTest/debug/AndroidCommon-debug-androidTest.apk]
Unknown platform error occurred when running the UTP test suite. Please check logs for details.
com.android.ddmlib.ShellCommandUnresponsiveException
at com.android.ddmlib.internal.DeviceImpl.lambda$executeRemoteCommand$20(DeviceImpl.java:892)
at com.android.ddmlib.internal.DeviceImpl.logRun1(DeviceImpl.java:1802)
at com.android.ddmlib.internal.DeviceImpl.executeRemoteCommand(DeviceImpl.java:756)
at com.android.ddmlib.SplitApkInstallerBase.installCommit(SplitApkInstallerBase.java:137)
at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:85)
at com.android.ddmlib.IDeviceSharedImpl.installPackages(IDeviceSharedImpl.java:395)
at com.android.ddmlib.internal.DeviceImpl.lambda$installPackages$36(DeviceImpl.java:1492)
at com.android.ddmlib.internal.DeviceImpl.logRun3(DeviceImpl.java:1834)
at com.android.ddmlib.internal.DeviceImpl.installPackages(DeviceImpl.java:1489)
at com.android.ddmlib.internal.DeviceImpl.lambda$installPackages$37(DeviceImpl.java:1504)
at com.android.ddmlib.internal.DeviceImpl.logRun3(DeviceImpl.java:1834)
at com.android.ddmlib.internal.DeviceImpl.installPackages(DeviceImpl.java:1500)
at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDevice.installPackages(DdmlibAndroidDevice.kt:74)
at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDeviceController$executeAsync$deferred$1.invokeSuspend(DdmlibAndroidDeviceController.kt:254)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
There were failing tests. See the report at: file:///opt/atlassian/pipelines/agent/build/app/libs/AndroidCommon/build/reports/androidTests/connected/debug/index.html
> Task :app:libs:AndroidCommon:connectedAndroidTest
> Task :app:connectedDebugAndroidTest
additionalTestOutput is not supported on this device running API level 23 because the additional test output directory could not be found
Exception thrown during onBeforeAll invocation of plugin AndroidTestApkInstallerPlugin: ErrorName: Test APK installation Error
NameSpace: AndroidTestApkInstallerPlugin
ErrorCode: 2002
ErrorType: TEST
Message: Failed to install APK: [/opt/atlassian/pipelines/agent/build/app/build/outputs/apk/debug/app-debug.apk] on device emulator-5554.
Failed to install APK: [/opt/atlassian/pipelines/agent/build/app/build/outputs/apk/debug/app-debug.apk] on device emulator-5554.
com.google.testing.platform.core.error.UtpException: ErrorName: Test APK installation Error
NameSpace: AndroidTestApkInstallerPlugin
ErrorCode: 2002
ErrorType: TEST
Message: Failed to install APK: [/opt/atlassian/pipelines/agent/build/app/build/outputs/apk/debug/app-debug.apk] on device emulator-5554.
at com.android.tools.utp.plugins.host.apkinstaller.AndroidTestApkInstallerPlugin.beforeAll(AndroidTestApkInstallerPlugin.kt:236)
at com.google.testing.platform.plugin.PluginLifecycle$onBeforeAll$1$1$2$1$1.invoke(PluginLifecycle.kt:206)
at com.google.testing.platform.plugin.PluginLifecycle$onBeforeAll$1$1$2$1$1.invoke(PluginLifecycle.kt:206)
at com.google.testing.platform.plugin.PluginLifecycle$verify$1.invoke(PluginLifecycle.kt:131)
at com.google.testing.platform.api.event.Events$DefaultImpls.verify(Events.kt:38)
at com.google.testing.platform.core.event.MutableEvents$DefaultImpls.verify(MutableEvents.kt:7)
at com.google.testing.platform.core.event.PhaseGlobalEvents.verify(PhaseGlobalEvents.kt:20)
at com.google.testing.platform.plugin.PluginLifecycle.verify(PluginLifecycle.kt:131)
at com.google.testing.platform.plugin.PluginLifecycle.verify$default(PluginLifecycle.kt:127)
at com.google.testing.platform.plugin.PluginLifecycle$onBeforeAll$1$1$2$1.invoke(PluginLifecycle.kt:206)
at com.google.testing.platform.plugin.PluginLifecycle$onBeforeAll$1$1$2$1.invoke(PluginLifecycle.kt:205)
at com.google.testing.platform.plugin.PluginLifecycleKt$invokeOrThrow$1$1.invoke(PluginLifecycle.kt:538)
at com.google.testing.platform.plugin.PluginLifecycleKt$invokeOrThrow$1$1.invoke(PluginLifecycle.kt:538)
at com.google.testing.platform.core.telemetry.common.noop.NoopDiagnosticsScope.recordEvent(NoopDiagnosticsScope.kt:35)
at com.google.testing.platform.core.telemetry.SequentialEventRecordRequest.record$java_com_google_testing_platform_core_telemetry_telemetry_api(EventRecordRequest.kt:71)
at com.google.testing.platform.core.telemetry.DiagnosticsExtKt.record(DiagnosticsExt.kt:27)
at com.google.testing.platform.core.telemetry.TelemetryKt.createEvent(Telemetry.kt:60)
at com.google.testing.platform.plugin.PluginLifecycleKt.invokeOrThrow(PluginLifecycle.kt:533)
at com.google.testing.platform.plugin.PluginLifecycleKt.invokeOrThrow$default(PluginLifecycle.kt:517)
at com.google.testing.platform.plugin.PluginLifecycle$onBeforeAll$1$1.invoke(PluginLifecycle.kt:205)
at com.google.testing.platform.plugin.PluginLifecycle$onBeforeAll$1$1.invoke(PluginLifecycle.kt:199)
at com.google.testing.platform.core.telemetry.common.noop.NoopDiagnosticsScope.recordEvent(NoopDiagnosticsScope.kt:35)
at com.google.testing.platform.core.telemetry.SequentialEventRecordRequest.record$java_com_google_testing_platform_core_telemetry_telemetry_api(EventRecordRequest.kt:71)
at com.google.testing.platform.core.telemetry.DiagnosticsExtKt.record(DiagnosticsExt.kt:27)
at com.google.testing.platform.core.telemetry.TelemetryKt.createEvent(Telemetry.kt:60)
at com.google.testing.platform.plugin.PluginLifecycle.onBeforeAll(PluginLifecycle.kt:197)
at com.google.testing.platform.executor.SingleDeviceExecutor$execute$5.invoke(SingleDeviceExecutor.kt:136)
at com.google.testing.platform.executor.SingleDeviceExecutor$execute$5.invoke(SingleDeviceExecutor.kt:136)
at com.google.testing.platform.lib.cancellation.ProcessCancellationContext.runUnlessCancelled(ProcessCancellationContext.kt:136)
at com.google.testing.platform.executor.SingleDeviceExecutor.execute(SingleDeviceExecutor.kt:136)
at com.google.testing.platform.RunnerImpl.run(RunnerImpl.kt:121)
at com.google.testing.platform.server.strategy.NonInteractiveServerStrategy$run$4$2.invoke(NonInteractiveServerStrategy.kt:98)
at com.google.testing.platform.server.strategy.NonInteractiveServerStrategy$run$4$2.invoke(NonInteractiveServerStrategy.kt:98)
at com.google.testing.platform.core.telemetry.common.noop.NoopDiagnosticsScope.recordEvent(NoopDiagnosticsScope.kt:35)
at com.google.testing.platform.core.telemetry.SequentialEventRecordRequest.record$java_com_google_testing_platform_core_telemetry_telemetry_api(EventRecordRequest.kt:71)
at com.google.testing.platform.core.telemetry.DiagnosticsExtKt.record(DiagnosticsExt.kt:27)
at com.google.testing.platform.core.telemetry.TelemetryKt.createEvent(Telemetry.kt:60)
at com.google.testing.platform.server.strategy.NonInteractiveServerStrategy.run(NonInteractiveServerStrategy.kt:95)
at com.google.testing.platform.main.MainKt$main$4.invokeSuspend(Main.kt:75)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at com.google.testing.platform.main.MainKt.main(Main.kt:73)
at com.google.testing.platform.main.MainKt.main$default(Main.kt:35)
at com.google.testing.platform.main.MainKt.main(Main.kt)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.google.testing.platform.launcher.Launcher.main(Launcher.java:154)
There were failing tests. See the report at: file:///opt/atlassian/pipelines/agent/build/app/build/reports/androidTests/connected/debug/index.html
> Task :app:connectedAndroidTest
> Task :mergeAndroidReports
BUILD SUCCESSFUL in 23m 47s
324 actionable tasks: 324 executed
当执行最后一个杀模拟器的脚本时,就成功了。
adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done
saving arm snapshot.... !!!
OK: killing emulator, bye bye
OK
INFO | Wait for emulator (pid 380) 20 seconds to shutdown gracefully before kill;you can set environment variable ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL(in seconds) to change the default value (20 seconds)
用
adb devices -l
再次尝试,它显示已连接的设备
emulator-5554 device product:sdk_google_phone_armv7 model:sdk_google_phone_armv7 device:generic transport_id:1
然后在应用程序模块中运行仪器测试时出现不同的错误
> Task :app:connectedDebugAndroidTest
additionalTestOutput is not supported on this device running API level 23 because the additional test output directory could not be found
Exception thrown during onBeforeAll invocation of plugin AndroidTestApkInstallerPlugin: ErrorName: UNKNOWN
NameSpace: DdmlibAndroidDeviceController
ErrorCode: 1
ErrorType: TEST
Message: Failed to install split APK(s): [/opt/atlassian/pipelines/agent/build/app/build/outputs/apk/debug/app-debug.apk]
Failed to install split APK(s): [/opt/atlassian/pipelines/agent/build/app/build/outputs/apk/debug/app-debug.apk]
Failed to install-write all apks
com.android.ddmlib.InstallException: Failed to install-write all apks
at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:83)
at com.android.ddmlib.IDeviceSharedImpl.installPackages(IDeviceSharedImpl.java:395)
at com.android.ddmlib.internal.DeviceImpl.lambda$installPackages$36(DeviceImpl.java:1492)
at com.android.ddmlib.internal.DeviceImpl.logRun3(DeviceImpl.java:1834)
at com.android.ddmlib.internal.DeviceImpl.installPackages(DeviceImpl.java:1489)
at com.android.ddmlib.internal.DeviceImpl.lambda$installPackages$37(DeviceImpl.java:1504)
at com.android.ddmlib.internal.DeviceImpl.logRun3(DeviceImpl.java:1834)
at com.android.ddmlib.internal.DeviceImpl.installPackages(DeviceImpl.java:1500)
at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDevice.installPackages(DdmlibAndroidDevice.kt:74)
at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDeviceController$executeAsync$deferred$1.invokeSuspend(DdmlibAndroidDeviceController.kt:254)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
尝试使用尽可能简单的映像,例如 x86 而不是 x86_64,然后在没有 Google API 的情况下添加
-no-accel
以在没有 VM 加速的情况下启动模拟器。
# Configure Android SDK and Android Virtual Device (AVD)
- sdkmanager --list # Print the Android SDK's list of installed and available packages, install packages, and update packages https://developer.android.com/tools/sdkmanager#usage
- sdkmanager "system-images;android-21;default;x86" # Download an Android System Image
- echo no | avdmanager create avd -n EMU --abi default/x86 -k "system-images;android-21;default;x86" # Create an Android Virtual Device named EMU, the specified ABI and system image will be use for this emulator
# Start AVD without visual or audio output and block until device is online https://android.googlesource.com/platform/system/core/+/4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53/adb/commandline.c#143
- emulator -avd EMU -memory 2048 -cache-size 1000 -partition-size 6144 -wipe-data -no-accel -no-window -no-audio -no-boot-anim & adb wait-for-device
- adb devices -l # Check connected devices
- "./gradlew connectedAndroidTest mergeAndroidReports --continue"