2

in the build.gradle file i set the minifyEnabled to be true as shown in the code below. my question is how can i see the effect of this statement? or in other words, as i am trying to minify the code and obfuscating it, where can i see the code minified and obfuscated where is the result of this statement.

build.gradle:

buildTypes {
    debug {
        debuggable true
    }
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
Amrmsmb
  • 1
  • 27
  • 104
  • 226

2 Answers2

2

The probably easiest way to verify that shrinking and obfuscation has been applied to your project is to check for the existence of the mapping file.

When ProGuard is executed during the android build using gradle, the following files are generated automatically (located in build/outputs/mapping/<buildtype>/):

  • mapping.txt: contains the mapping from original class / class member names to obfuscated ones
  • seeds.txt: contains the seeds that were used during shrinking, i.e. the classes / class members specified in -keep rules
  • usage.txt: contains the removed classes during shrinking

With the presence and contents of these files you can verify that ProGuard was executed correctly.

T. Neidhart
  • 6,060
  • 2
  • 15
  • 38
  • the problem now is, i cant enable the proguard in android studio. whenever i set minifyEnabled to true and sync, i receive error.please have a look at my question here: http://stackoverflow.com/questions/38203688/gradle-generate-error-when-minifying-the-code?noredirect=1#comment63832269_38203688 – Amrmsmb Jul 05 '16 at 14:02
2

You can check it in simple way, just extract your apk, decompile .dex files and look at decompile sources.

Obfuscated code should have changed classes, functions, variables names.

Here is insightful post about how to do it.

Community
  • 1
  • 1
koliczyna
  • 280
  • 1
  • 11
  • the problem now is, i cant enable the proguard in android studio. whenever i set minifyEnabled to true and sync, i receive error.please have a look at my question here: http://stackoverflow.com/questions/38203688/gradle-generate-error-when-minifying-the-code?noredirect=1#comment63832269_38203688 – Amrmsmb Jul 05 '16 at 14:03