Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jetpack compose can not inspect in AS Layout Inspector

Jetpack compose can not inspect in AS Layout Inspector. Is there any tools can inspect compose layoutnode.

like image 307
Eugene Avatar asked Nov 25 '25 04:11

Eugene


2 Answers

After Enabling Enable View Attributes in Device's Developer Options solved the issue for me in Android 12 Device

like image 73
VIGNESH Avatar answered Nov 28 '25 00:11

VIGNESH


For me, I have to do this to make LayoutInspector works with Compose (Enabling Enable View Attributes in Device's Developer Options doesn't work).

// Before
packagingOptions {
    resources.excludes.add("META-INF/*")
}

// After
packagingOptions {
    // resources.excludes.add("META-INF/*")
}

It's mentioned in the Google issue tracker. The quote from the user comment:

On my project, i had a similar issue where the layout inspector was not working (the compose views where not shown). I solved it removing this line in my build.gradle :

packagingOptions {
    resources.excludes += setOf(
        "META-INF/*.version", <= Removing this line
        "META-INF/proguard/*",
        "META-INF/*.kotlin_module",
        "META-INF/DEPENDENCIES",
        "META-INF/AL2.0",
        "META-INF/LGPL2.1",
        "META-INF/*.properties",
        "/*.properties"
    )
}
like image 34
aldok Avatar answered Nov 28 '25 02:11

aldok