androidandroid-studiogradleapkandroid-r8

Android Studio 4.2 started to rename resources inside APK in release build


Recently I updated to Android Studio 4.2.1 from 4.1.3 and found everything in APK under res/ folder renamed(can I call it "obfuscated"?) when I build in release mode.

In debug it's the same as it was in older version. I use console build with gradlew assembleRelease.

I found no changelog or official word why this happening. Tried to disable it by adding shrinkResources false in app/build.gradle and using res/raw/keep.xml. Even with minifyEnabled false resources got renamed.

When I install apk to device all my icons and images seem to show as before, but my app distribute Web tool can't show app icon any more.

Anyone got the same and knows how to turn it off in release build?


Solution

  • The behavior was enabled by default starting with Android Gradle Plugin 4.2 and it can be disabled by adding android.enableResourceOptimizations=false to the gradle.properties file.

    See https://github.com/godotengine/godot/pull/50665 for reference.