There are a lot of problems with Android code confusion, here are a few things to note 1. The jar Baujo used in the dependent project is the same as the jar package in the project itself, and the same jar package can be removed directly from the dependent project. 2.native method to block obfuscation example: # Natvie method does not confuse-keepclasseswithmembernames class * {native <methods>;} 3. If there is a custom base class activity in which the control injects values by name, the following method is used to prevent the field from being mixed as the base class activity has the following control injection method protected void Smartinject () {class<? exte NDS activity> Clz=getclass (); Field[] Fs=clz.getdeclaredfields (); Resources res = getresources (); String PackageName = Getpackagename (); for (Field field:fs) {if (! View.class.isAssignableFrom (Field.gettype ())) {continue;} int viewId = Res.getidentifier (Field.getname (), "id", packagename); if (viewid==0) continue; Field.setaccessible (TRUE); try {View V=findviewbyid (viewId); Field.set (THIS,V); Class<?> C=field.gettype (); Method M=c.getmethod ("Setonclicklistener", Android.view.View.OnClickListener.class); M.invoke (V, this); } catch (Throwable e) {//E.printstacktrace (); } field.setaccessible (FALSE); }}-keep class App package name. r$id{*;} -keep public class * extends package name. base class Activity {<fields>;} 3. Common some code to prevent the confusion of the wording-keep class com.iflytek.**{*;} -libraryjars Libs/baidulbs_android.jar-libraryjars Libs/fastjson-1.1.39.jar-libraryjars libs/ Bcprov-jdk15-143.jar-libraryjars Libs/android-support-v4.jar-keep class com.baidu.** {*;}-keep class Vi.com.gdi.bgl. android.**{*;}-keep class okio.** {*;} -dontwarn Okio.**-dontwarn com.alibaba.**-dontwarn org.bouncycastle.**-keepattributes Signature-keepattributes * annotation*
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android Code obfuscation considerations