Search code examples
androidobfuscation

using proguard to obfuscate android library using android studio


My requirement is to obfuscate an android library using Proguard and then study behaviour of the obfuscated code that is generated. I made the changes in my module's build.gradle and when I build my lib, I get a build folder inside my module folder. In that build folder, I have the output generated. In intermediate folder(inside module>build) I get all the obfuscated java files(class files). But when I open these files outside android studio, I see there is a large difference but when opened inside android studio, they are opening as the same java files(as in no obfuscation visible at all). I am confused as to what is the correct way to go about this entire process. Also, if I need to study how the string variables are obfuscated. Need pointers.


Solution

  • in gradle.build you will use

    buildTypes {
            release {
                minifyEnabled true
                shrinkResources true
                proguardFiles getDefaultProguardFile('proguard-android.txt'),      'proguard-rules.pro'
    }
    }