Layout inspector not showing composables tree

Viewed 1927

When I use Layout Inspector in a running compose app on a device, I do not obtain the composables tree but the view system tree. How to see the composables tree? Thanks

enter image description here

Note: As I run Layout inspector in Android Studio, I still get the following error:
Unable to set the global setting: "debug_view_attributes_application_package" to: "com.example.statecodelab" Error: Security exception: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS at com.android.providers.settings.SettingsProvider.enforceWritePermission(SettingsProvider.java:2340) at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1405) at com.android.providers.settings.SettingsProvider.insertGlobalSetting(SettingsProvider.java:1379) at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:556) at android.content.ContentProvider.call(ContentProvider.java:2162) at android.content.ContentProvider$Transport.call(ContentProvider.java:481) at com.android.providers.settings.SettingsService$MyShellCommand.putForUser(SettingsService.java:375) at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:277) at android.os.ShellCommand.exec(ShellCommand.java:104) at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:49) at android.os.Binder.shellCommand(Binder.java:881) at android.os.Binder.onTransact(Binder.java:765) at android.os.Binder.execTransactInternal(Binder.java:1021) at android.os.Binder.execTransact(Binder.java:994)

3 Answers

Solution for Samsung Galaxy S10 (API 31) Go to Settings -> Developer Options -> Enable option 'Enable view attribute inspection'

Finally got it.

Looking at the error: Error: Security exception: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS, I got over this error by enabling the "Disable Permission Monitoring" on Developer options of my mobile phone (realme 6i).

Once I fixed the previous error the Layout inspector for a Compose app works fine.

Note that even though the error described above existed at the time of the post, it was possible to run the Layout inspector but its result was not correct for a jetpack compose application.
I would like to thank all of you that tried to help me solve this issue.

It is probably supported on API >=30

Related