Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sleekweasel opened this issue Sep 9, 2021 · 4 comments
Closed

Comments

@sleekweasel
Copy link

sleekweasel commented Sep 9, 2021

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
####################################

@sleekweasel
Copy link
Author

Incidentally, where are the latest sources for ddmlib, and is there a way to contribute patches to it if we find the problem?

Thanks.

@sleekweasel
Copy link
Author

sleekweasel commented Sep 14, 2021

Android12 lacks the device density property. Reported here:

https://issuetracker.google.com/issues/199754670?pli=1

@ymakhno
Copy link

ymakhno commented Sep 16, 2021

We are able to reproduce the issue and working on the fix.

@ymakhno
Copy link

ymakhno commented Sep 30, 2021

Fixed in 1.8.1

@ymakhno ymakhno closed this as completed Sep 30, 2021
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this issue Oct 1, 2021
Context: https://github.com/google/bundletool/releases/tag/1.8.1
Changes: google/bundletool@1.4.0...1.8.1
Fixes: dotnet#6354

`dotnet build -c Release -t:Install` fails on an API-31 emulator with:

    [BT : 1.4.0] error : Error retrieving device density. Please try again.

Updating `bundletool` with the fix:

    Android12 emulator fails due to 'Error retrieving device density'

google/bundletool#241
jonathanpeppers added a commit to dotnet/android that referenced this issue Oct 2, 2021
Context: https://github.com/google/bundletool/releases/tag/1.8.1
Changes: google/bundletool@1.4.0...1.8.1
Fixes: #6354

`dotnet build -c Release -t:Install` fails on an API-31 emulator with:

    [BT : 1.4.0] error : Error retrieving device density. Please try again.

Updating `bundletool` with the fix:

    Android12 emulator fails due to 'Error retrieving device density'

google/bundletool#241
jonpryor pushed a commit to jonpryor/xamarin-android that referenced this issue Oct 18, 2021
Fixes: dotnet#6354
Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1414786

Context: https://github.com/google/bundletool/releases/tag/1.8.1
Context: google/bundletool#241

Changes: google/bundletool@1.4.0...1.8.1

`dotnet build -c Release -t:Install` fails on an API-31 emulator with:

    [BT : 1.4.0] error : Error retrieving device density. Please try again.

Updating `bundletool` with the fix:

    Android12 emulator fails due to 'Error retrieving device density'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants