Lack of proper documentation on gradle method resConfigs
made me ask this question.
If I specify something in front of resConfigs
, only that gets included in the final build, everything else does not get bundled into the apk.
The test app has
Note: I used android studios' apk analyzer to deduce the following results. before every test, full clean, rebuild, and prod build was generated with proguard(shrink) enabled.
Test 1:
I specified only languages resConfigs="en", "fr"
Result 1: In the apk,
Test 2:
I specified only drawables resConfigs="xxhdpi"
Result 2: In the apk,
Test 3:
I specified languages and drawable resConfigs="en","fr","xxhdpi"
Result 3: In the apk,
resConfigs="en", "fr"
, why are other resources getting bundled into the apk (for eg: drawables)resConfigs="xxhdpi"
, why languages and other resources get bundledresConfigs
only worked for me on app level gradle only. When I tried to use it on a dependent module, it ignored it completely. How to make it work on a dependent module. (I was trying to integrate firebaseUI for auth)resConfigs
in early stages of development, or is it meant only for development purposes, and not to be used in prod setups?Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.
Discussion. A build type determines how an app is packaged. By default, the Android plug-in for Gradle supports two different types of builds: debug and release . Both can be configured inside the buildTypes block inside of the module build file.
To enable R8, open build. gradle module app file and add this piece of code inside the buildTypes . The code inside the release{} block means that this will be applied to the release build version of your application. If you launch the app in the emulator, this code is not executed.
minify is an Android tool that will decrease the size of your application when you go to build it. It's extremely useful as it means smaller apk files! It detects any code or libraries that aren't being used and ignores them from your final apk.
here are a few things to keep in mind
When you provide a resource qualifier to resConfigs then all other resources for qualifiers in that bucket will be removed. Resources in other buckets are not affected .
Please refer to the following link for all the available grouping/buckets . https://developer.android.com/guide/topics/resources/providing-resources#AlternativeResources
hope this makes sense.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With