Android: i want to create code very secure [closed]

不问归期 提交于 2019-12-23 06:42:33

问题


My question is to develop one application in android, so meanwhile I want to create well secure code, I'm uploading APK in play store how to obfuscates my code using a Proguard, I need to obfuscate class names, libraries, id and basic functionalities in the Proguard.

Please help me to do how secure my code in a play store?


回答1:


Add these lines in build.gradle file in your module app file not project file

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

And add these lines in proguard-rules.pro file

-dontwarn com.android.volley.toolbox.**
-keep class org.codehaus.** { *; }
-dontwarn android.support.v7.**
-keep android.support.v7.**
-dontwarn android.support.**
-keepattributes **
-keepattributes   Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod


-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep class android.support.v7.app.** { *; }
-keep interface android.support.v7.app.** { *; }
-keep class android.support.v13.app.** { *; }
-keep interface android.support.v13.app.** { *; }
-dontwarn android.support.design.**
-keep class android.support.design.** { *; }
-keep interface android.support.design.** { *; }
-keep public class android.support.design.R$* { *; }
-dontwarn org.apache.http.**
-dontwarn com.mixpanel.**
-dontwarn org.codehaus.jackson.**
-dontwarn org.acra.ErrorReporter.**
-dontwarn com.jeremyfeinstein.slidingmenu.**
-keepnames class com.fasterxml.jackson.** { *; }
-keepclassmembers public final enum     

Please note do not forget to add external libraries in proguard rules else app will be crash and you will get NoClassDefFoundError exception



来源:https://stackoverflow.com/questions/35306797/android-i-want-to-create-code-very-secure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!