Assuming I need to apply the same rules for both an application project and a library project on which it relies, do I need to duplicate the content of proguard.cfg from the
In build.gradle of library project, add line: consumerProguardFiles 'proguard-rules.pro'
in buildTypes as:
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
consumerProguardFiles 'proguard-rules.pro'
}
}
In build.gradle
of root project, enable minifyEnabled
.
The libraray proguard will work.
Library projects by themselves don't run ProGuard, so they don't use any configuration.
Application projects obfuscate the entire code base, including any referenced libraries, so they need proper configuration for the application code and for the library code.
It appears that the answer is "No": Proguard will obfuscate code from the libraries too.
But that was in 2010 and we know very well that specifications keep changing, especially in the Android development tools. So if a more authoritative answer comes along, I will accept it.