Status Update
Comments
de...@gmail.com <de...@gmail.com> #2
I tried adding screenshotTestImplementation(libs.androidx.window)
but it didn't fix it.
de...@gmail.com <de...@gmail.com> #3
This is likely a duplicate of libs.androidx.window
dependency to implementation
to see if it works?
de...@gmail.com <de...@gmail.com> #4
de...@gmail.com <de...@gmail.com> #5
Tried with system-images;android-21;google_apis;x86
Emulator command
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
Result
* daemon not running; starting now at tcp:5037
INFO | Storing crashdata in: /tmp/android-unknown/emu-crash-34.2.13.db, detection is enabled for process: 379
INFO | Android emulator version 34.2.13.0 (build_id 11772612) (CL:N/A)
INFO | Found systemPath /opt/android-sdk-linux/system-images/android-21/google_apis/x86/
WARNING | File System is not ext4, disable QuickbootFileBacked feature
* daemon started successfully
ERROR | resizing partition resize2fs failed with exit code 1
WARNING | encryption is off
WARNING | x86 emulation may not work without hardware acceleration!
WARNING | FeatureControl is requesting a non existing feature.
WARNING | FeatureControl is requesting a non existing feature.
WARNING | Your GPU drivers may have a bug. Switching to software rendering.
WARNING: cannnot unmap ptr 0x7f1ce586f000 as it is in the protected range from 0x7f1ce586f000 to 0x7f1d65a6f000
WARNING: cannnot unmap ptr 0x7f1d65a01000 as it is in the protected range from 0x7f1ce586f000 to 0x7f1d65a6f000
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.2.13.db, detection is enabled for process: 379
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
INFO | Initializing hardware OpenGLES emulation support
android_startOpenglesRenderer: gpu infoI0502 09:19:54.689230 379 HealthMonitor.cpp:279] HealthMonitor disabled.
I0502 09:19:54.704985 379 FrameBuffer.cpp:506] Graphics Adapter Vendor Google (Google Inc.)
I0502 09:19:54.704994 379 FrameBuffer.cpp:507] Graphics Adapter Android Emulator OpenGL ES Translator (Google SwiftShader)
I0502 09:19:54.704995 379 FrameBuffer.cpp:508] Graphics API Version OpenGL ES 3.0 (OpenGL ES 3.0 SwiftShader 4.0.0.1)
I0502 09:19:54.704997 379 FrameBuffer.cpp:509] 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
I0502 09:19:54.704998 379 FrameBuffer.cpp:510] Graphics Device Extensions N/A
INFO | OpenGL Vendor=[Google (Google Inc.)]
INFO | OpenGL Renderer=[Android Emulator OpenGL ES Translator (Google SwiftShader)]
INFO | OpenGL Version=[OpenGL ES 3.0 (OpenGL ES 3.0 SwiftShader 4.0.0.1)]
INFO | Monitoring duration of emulator setup.
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/379/jwks/28737df3-8485-4f05-bc64-eafc535ae85f/active.jwk
INFO | Scanning /opt/android-sdk-linux/.android/avd/running/379/jwks/28737df3-8485-4f05-bc64-eafc535ae85f 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_379.ini
I0502 09:19:55.157362 434 FrameBuffer.cpp:2853] setDisplayConfigs w 320 h 640 dpiX 160 dpiY 160
I0502 09:19:55.157394 434 FrameBuffer.cpp:2866] setDisplayActiveConfig 0
##############################################################################
## WARNING - ACTION REQUIRED ##
## Consider using the '-metrics-collection' flag to help improve the ##
## emulator by sending anonymized usage data. Or use the '-no-metrics' ##
## flag to bypass this warning and turn off the metrics collection. ##
## In a future release this warning will turn into a one-time blocking ##
## prompt to ask for explicit user input regarding metrics collection. ##
## ##
## Please see '-help-metrics-collection' for more details. You can use ##
## '-metrics-to-file' or '-metrics-to-console' flags to see what type of ##
## data is being collected by emulator as part of usage statistics. ##
##############################################################################
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 'cache' does not have the requested snapshot 'default_boot'
WARNING | Failed to load snapshot 'default_boot'
INFO | Cold boot based on user configuration
WARNING | Cold boot based on user configuration
WARNING | Failed to process .ini file /opt/android-sdk-linux/.android/emu-update-last-check.ini for reading.
ADB command
adb devices -l
Result
List of devices attached
emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:1
Error in installation
> Task :app:libs:AndroidCommon:connectedDebugAndroidTest
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/libs/AndroidCommon/build/outputs/apk/androidTest/debug/AndroidCommon-debug-androidTest.apk] on device emulator-5554.
Failed to install APK: [/opt/atlassian/pipelines/agent/build/app/libs/AndroidCommon/build/outputs/apk/androidTest/debug/AndroidCommon-debug-androidTest.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/libs/AndroidCommon/build/outputs/apk/androidTest/debug/AndroidCommon-debug-androidTest.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)
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
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)
> Task :app:connectedDebugAndroidTest
additionalTestOutput is not supported on this device running API level 21 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]
'pm install-create -r -t -S 20110736' returns error 'Unknown failure: Error: Could not access the Package Manager. Is the system running?'
com.android.ddmlib.InstallException: 'pm install-create -r -t -S 20110736' returns error 'Unknown failure: Error: Could not access the Package Manager. Is the system running?'
at com.android.ddmlib.SplitApkInstallerBase.createMultiInstallSession(SplitApkInstallerBase.java:124)
at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:68)
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)
There were failing tests. See the report at: file:///opt/atlassian/pipelines/agent/build/app/build/reports/androidTests/connected/debug/index.html
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
> Task :app:connectedAndroidTest
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
> Task :mergeAndroidReports
BUILD SUCCESSFUL in 11m 59s
324 actionable tasks: 324 executed
de...@gmail.com <de...@gmail.com> #6
cm...@google.com <cm...@google.com>
hu...@google.com <hu...@google.com>
da...@google.com <da...@google.com> #7
Try running the emulator command with the gpu flag to not use hardware acceleration. emulator -avd EMU -no-window -no-audio -no-boot-anim -gpu swiftshader_indirect
. Although -gpu auto-no-window
might be better. I'm a little fuzzy on the details of --auto-no-window, my understanding is the emulator can have issues detecting when it is being run in a CI environment.
As to the shell command timeouts, using arm emulation on x86 is notoriously slow. So seeing shell command timeouts is not surprising. Try the above fix with the AVD with the x86_64 system image, and let me know if that fixes it.
de...@gmail.com <de...@gmail.com> #8
I was able and managed to run the emulator with this system image system-images;android-23;default;x86_64
then start it with the following commands
emulator -avd EMU -memory 2048 -partition-size 4096 -wipe-data -no-accel -no-window -no-audio -no-boot-anim & adb wait-for-device
Should I still need -gpu swiftshader_indirect
? Also is the -no-accel
option no longer available? I can't remember where did I saw this option, I assumed its from the Android doc.
de...@gmail.com <de...@gmail.com> #9
Oh I found where I get the -no-accel
option, it is here -no-snapshot-save
will also probably help reducing build minute consumption for quicker termination of emulator.
de...@gmail.com <de...@gmail.com> #10
However I can't find this ADB wait-for-devices
command in the
da...@google.com <da...@google.com> #11
Should I still need
-gpu swiftshader_indirect
? Also is the-no-accel
option no longer available?
So, I know that using swiftshader_indirect
guarantees software graphics, which should be correct for CI. auto-no-window
(the default when -no-window
flag is set) should default to use software, but, from my limited understanding of the emulator, the emulator struggles to make that determination within virtual machines.
-no-accel
is still available and -no-snapshot-save
also exists. According to ./emulator --help
:
-no-accel
same as -accel off
-accel <mode>
Configure emulation acceleration
-no-snapshot-save
do not auto-save to snapshot on exit: abandon changed state
Unless you are using the emulator snapshot after tests complete, disabling the snapshot auto-save makes perfect sense.
Description
I am trying to run an AVD without window and boot animation for instrumented test in a pipeline workflow with Bitbucket. I am using Docker image with Android SDK that uses Linux Ubuntu.
The setup works and managed to create AVD however there is an error when starting it as it ask for hardware acceleration.
SCRIPT
ERROR
Based from this SO answer , I could probably use ARM as last resort even if it's slow as it does not requires hardware acceleration so I use
system-images;android-23;google_apis;armeabi-v7a
I change the script to wait for adb before running gradlew
Emulator start
Instrumented test start
But then I get an error where seems like the emulator is not responding.