简体   繁体   中英

how to protect our app by using obfuscation[proguard] in android studio

I am searching for protecting my app by using proguard but I didnt find proper answer how to protect my app. If any body know how to protect our app using obfuscation in proguard help me.

If you are using Android Studio

  1. Go to build.gradle file of your app
  2. Check for below snippet in the file

Put minifyEnabled as 'true';

buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                                                 'proguard-rules.pro'
        }
}
  1. In proguard-rules.pro add excpetions and rules matching your app.

Eg

-keep public class * extends android.support.v7.app.ActionBarActivity
-keep public class * extends your.package.name.SomeClass
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM