Amrmsmb
Amrmsmb

Reputation: 11388

how can i see the effect of the minified code

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'
    }
}

Upvotes: 2

Views: 1942

Answers (2)

koliczyna
koliczyna

Reputation: 290

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.

Upvotes: 2

T. Neidhart
T. Neidhart

Reputation: 6200

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.

Upvotes: 2

Related Questions