Skip to content

Android12 emulator fails due to 'Error retrieving device density' #241

@sleekweasel

Description

@sleekweasel

Describe the bug

bundletool 1.8.0 doesn't seem to work with Android 12 emulator.

Bundletool version(s) affected
Version: 1.8.0 (downloaded from https://github.com/google/bundletool/releases)

Stacktrace
$ java -jar Downloads/bundletool-all-1.8.0.jar get-device-spec --device-id emulator-5554 --output foo.json
[BT:1.8.0] Error: Error retrieving device density. Please try again.
java.lang.IllegalStateException: Error retrieving device density. Please try again.
at com.google.common.base.Preconditions.checkState(Preconditions.java:508)
at com.android.tools.build.bundletool.device.DeviceAnalyzer.getDeviceSpec(DeviceAnalyzer.java:60)
at com.android.tools.build.bundletool.commands.GetDeviceSpecCommand.execute(GetDeviceSpecCommand.java:162)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:86)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:49)

To Reproduce
Steps to reproduce the behavior.

  1. Download Android 12 (Google APIs, not playstore) and use Android Studio to create default emulator
  2. Run java -jar Downloads/bundletool-all-1.8.0.jar get-device-spec --device-id emulator-5554 --output foo.json
  3. It complains about retrieving density.
  4. Same thing happens when trying to install an APKS file, but get-device-spec is simpler to report.

Expected behavior

It retrieves density.

Known workaround

Nope.

Environment:
OS: Linux timblenovo 5.4.0-81-generic #91~18.04.1-Ubuntu SMP Fri Jul 23 13:36:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ adb version
Android Debug Bridge version 1.0.41
Version 31.0.3-7562133
Installed as /home/tim/Android/Sdk/platform-tools/adb

Additional context

I've reproduced similar behaviour on our test system (with a rather older version of bundletool, and with the 1.8.0 version) and my colleague has independently reproduced it on her machine.

[16:50:18]~$ cat ~/.android/avd/Pixel_2_API_31.avd/config.ini
AvdId = Pixel_2_API_31
PlayStore.enabled = false
abi.type = x86_64
avd.ini.displayname = Pixel 2 API 31
avd.ini.encoding = UTF-8
disk.dataPartition.size = 6442450944
fastboot.chosenSnapshotFile =
fastboot.forceChosenSnapshotBoot = no
fastboot.forceColdBoot = no
fastboot.forceFastBoot = yes
hw.accelerometer = yes
hw.arc = false
hw.audioInput = yes
hw.battery = yes
hw.camera.back = virtualscene
hw.camera.front = emulated
hw.cpu.arch = x86_64
hw.cpu.ncore = 4
hw.dPad = no
hw.device.hash2 = MD5:55acbc835978f326788ed66a5cd4c9a7
hw.device.manufacturer = Google
hw.device.name = pixel_2
hw.gps = yes
hw.gpu.enabled = yes
hw.gpu.mode = auto
hw.initialOrientation = Portrait
hw.keyboard = yes
hw.lcd.density = 420
hw.lcd.height = 1920
hw.lcd.width = 1080
hw.mainKeys = no
hw.ramSize = 1536
hw.sdCard = yes
hw.sensors.orientation = yes
hw.sensors.proximity = yes
hw.trackBall = no
image.sysdir.1 = system-images/android-31/google_apis/x86_64/
runtime.network.latency = none
runtime.network.speed = full
sdcard.size = 512M
showDeviceFrame = yes
skin.dynamic = yes
skin.name = pixel_2
skin.path = /home/tim/Android/Sdk/skins/pixel_2
tag.display = Google APIs
tag.id = google_apis
vm.heapSize = 256

[16:59:12]~$ cat Android/Sdk/system-images/android-31/google_apis/x86_64/build.prop
####################################

from generate-common-build-props

These properties identify this partition image.

####################################
ro.product.system.brand=google
ro.product.system.device=generic
ro.product.system.manufacturer=Google
ro.product.system.model=mainline
ro.product.system.name=mainline
ro.system.product.cpu.abilist=x86_64,arm64-v8a
ro.system.product.cpu.abilist32=
ro.system.product.cpu.abilist64=x86_64,arm64-v8a
ro.system.build.date=Wed Aug 25 19:40:02 UTC 2021
ro.system.build.date.utc=1629920402
ro.system.build.fingerprint=google/sdk_gphone64_x86_64/emulator64_x86_64_arm64:12/SPB5.210812.003/7673742:userdebug/dev-keys
ro.system.build.id=SPB5.210812.003
ro.system.build.tags=dev-keys
ro.system.build.type=userdebug
ro.system.build.version.incremental=7673742
ro.system.build.version.release=12
ro.system.build.version.release_or_codename=12
ro.system.build.version.sdk=31
####################################

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions