question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to get display density property on android 12 emulator

See original GitHub issue

The problem

It seems Android 12 does not have ro.sf.lcd_density https://github.com/appium/appium-android-driver/blob/e5bba2e4a5139abfa75a7d13061d11f459fe194d/lib/commands/general.js#L271-L281

Environment

  • Appium version (or git revision) that exhibits the issue: Appium 1.22.0
  • Last Appium version that did not exhibit the issue (if applicable):
  • Desktop OS/version used to run Appium:
  • Node.js version (unless using Appium.app|exe):
  • Npm or Yarn package manager:
  • Mobile platform/version under test:
  • Real device or emulator/simulator: Android 12 emulator.
  • Appium CLI or Appium.app|exe:

Details

[HTTP] --> GET /wd/hub/session/b31dd067-1826-4863-8863-51b76be41b9a/appium/device/display_density
[HTTP] {}
[debug] [W3C (b31dd067)] Calling AppiumDriver.getDisplayDensity() with args: ["b31dd067-1826-4863-8863-51b76be41b9a"]
[debug] [ADB] Running '/Users/kazuaki/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.sf.lcd_density'
[debug] [ADB] Running '/Users/kazuaki/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop qemu.sf.lcd_density'
[AndroidDriver] Failed to get display density property.
[debug] [W3C (b31dd067)] Encountered internal error running command: Error: Failed to get display density property.
[debug] [W3C (b31dd067)]     at Object.errorAndThrow (/Users/kazuaki/.nodebrew/node/v12.21.0/lib/node_modules/appium/node_modules/appium-support/lib/logging.js:94:35)
[debug] [W3C (b31dd067)]     at AndroidUiautomator2Driver.getDisplayDensity (/Users/kazuaki/.nodebrew/node/v12.21.0/lib/node_modules/appium/node_modules/appium-android-driver/lib/commands/general.js:309:7)
[HTTP] <-- GET /wd/hub/session/b31dd067-1826-4863-8863-51b76be41b9a/appium/device/display_density 500 120 ms - 631
[HTTP]

logcat:

10-05 00:09:10.583   546   603 W ProcessStats: Tracking association SourceState{148b235 system/1000 BTopFgs #19547} whose proc state 2 is better than process ProcessState{4388d98 com.google.android.gms.persistent/10101 pkg=com.google.android.gms} proc state 3 (12 skipped)
10-05 00:09:10.638   546  1722 D WifiNl80211Manager: Scan result ready event
10-05 00:09:10.639   546  1722 D WifiNative: Scan result ready event
10-05 00:09:10.694 10594 23231 I ChimeraConfigurator: Starting update, reason: 4 urgentFeatures: vision.ocr:-1
10-05 00:09:10.722  7001  7001 D LocationTracker: Got an updated location
10-05 00:09:10.783 10594 23231 I GmsDebugLogger: [73] 1801
10-05 00:09:10.799 10594 23231 I GmsDebugLogger: [30] [VisionOcr.optional:212420100800]
10-05 00:09:10.812 10594 23231 W ChimeraConfigService: Retry attempt was throttled. [CONTEXT service_id=264 ]
10-05 00:09:10.813 10594 23231 I GmsDebugLogger: [83] 1 [vision.ocr]
10-05 00:09:10.824 10594 23230 W Vision  : Request for optional module download of ocr failed. Request again.
10-05 00:09:10.824 10594 23230 I Vision  : Schedule retrying download ocr at 1398665 with backoff 640 seconds
10-05 00:09:15.174 23237 23237 W libc    : Access denied finding property "qemu.sf.lcd_density"
10-05 00:09:15.168 23237 23237 W getprop : type=1400 audit(0.0:195): avc: denied { read } for name="u:object_r:qemu_sf_lcd_density_prop:s0" dev="tmpfs" ino=221 scontext=u:r:shell:s0 tcontext=u:object_r:qemu_sf_lcd_density_prop:s0 tclass=file permissive=0
10-05 00:09:15.964   546   842 D ConnectivityService: releasing NetworkRequest [ REQUEST id=142, [ Transports: CELLULAR Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&NOT_VCN_MANAGED Uid: 10102 RequestorUid: 10102 RequestorPkg: com.google.android.googlequicksearchbox] ] (release request)
10-05 00:09:15.971   321   321 I netd    : networkSetPermissionForNetwork(101, 1) <4.75ms>
10-05 00:09:25.871   546  2077 W ProcessStats: Tracking association SourceState{148b235 system/1000 BTopFgs #19583} whose proc state 2 is better than process ProcessState{4388d98 com.google.android.gms.persistent/10101 pkg=com.google.android.gms} proc state 3 (19 skipped)

Link to Appium logs

Create a GIST which is a paste of your full Appium logs, and link them here. Do NOT paste your full Appium logs here, as it will make this issue very long and hard to read! If you are reporting a bug, always include Appium logs!

Code To Reproduce Issue [ Good To Have ]

Please remember that with sample code it’s easier to reproduce the bug and it’s much faster to fix it.

Please git clone https://github.com/appium/appium and from the sample-code directory, use one of your favourite languages and sample apps to reproduce the issue.

In case a similar scenario is missing in sample-code, please submit a PR with one of the sample apps provided.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mykola-mokhnachcommented, Oct 5, 2021

Both PRs have been published

1reaction
KazuCocoacommented, Oct 5, 2021

thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android12 emulator fails due to 'Error retrieving device density'
Describe the bug. bundletool 1.8.0 doesn't seem to work with Android 12 emulator. Bundletool version(s) affected
Read more >
Known issues with Android Studio and Android Gradle Plugin
To fix this issue, upgrade your Android 11 emulator to version 9 or higher by navigating to Tools > SDK Manager. In the...
Read more >
Support different pixel densities - Android Developers
Use density-independent pixels ... The first pitfall you must avoid is using pixels to define distances or sizes. Defining dimensions with pixels ...
Read more >
Troubleshoot known issues with Android Emulator
This page lists known issues, workarounds, and troubleshooting tips for the Android Emulator. If you encounter an issue not listed here or ...
Read more >
Troubleshoot Android Studio
Find guidance for troubleshooting common issues and configuration problems ... UI appear blurry or pixelated on your high-density display, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found