I’ve created my first Android project with two modules (:app
and :additionalModule
).
Now I want to create a release build with isMinifyEnabled = true
and all these things. Do I have to configure that in each module (build.gradle.kts
of each module) or only once in the project build.gradle.kts
or maybe only once in my "main" (:app
with MainActivity
) module?
2
Answers
Actual minification step is happening only in your application module.
Library modules can provide required R8/ProGuard configuration using
consumer-rules.pro
file.You need to enable R8/ProGuard only in your
:app
module.Thus, you should keep
isMinifyEnabled = true
only in your:app
module.The minifyEnabled flag is typically set in the build.gradle file of each module where you want to enable code shrinking and obfuscation (also known as minification).
If you want to enable it for all modules in your project, you can set it in the build.gradle file of your app module (usually named app/build.gradle). This way, it will be applied to the entire project unless overridden in specific module build.gradle files.