The role of code obfuscation will not be said. Here's a baidumapdemo example of code obfuscation:
This is the approximate outline of this project:
(1) No confusion after the APK anti-compilation situation:
Specific to the situation under each package:
It can be seen that the confusion is only a third-party jar package, which is not something we confuse, but a third-party jar package that comes with confusion.
(2) Then we start to confuse:
Take two steps:
(|) First step: Open Project.Properties
The original file is this:
See line 11th, and remove the # from the front of line 11th.
Became like this:
Here we are already confused. The result of the confusion is this:
You can see that the android.support.v4 is confused (should not be confused or necessary), the third party jar package is confused (originally they have been confused, and then you are confused).
To solve the above problems, you must specify those things to confuse those things without confusion, as follows:
Add in Proguard-project:
-libraryjars Libs/baidumapapi_v3_2_0.jar-dontwarn Com.baidu.mapapi.**-dontwarn Com.baidu.platform.**-dontwarn Com.baidu.location.**-dontwarn Com.baidu.vi.**-dontwarn Vi.com.gdi.bgl.android.**-dontwarn com.baidu.lbsapi.**- Dontwarn Com.baidu.android.**-dontwarn Android.support.v4.**-keep class com.baidu.mapapi.** {*;} -keep class com.baidu.platform.** {*;} -keep class com.baidu.location.** {*;} -keep class com.baidu.vi.** {*;} -keep class com.baidu.lbsapi.** {*;} -keep class vi.com.gdi.bgl.android.** {*;} -keep class com.baidu.android.** {*;} -keep class android.support.v4.** {*;} -keep interface android.support.v4.app.** {*;}
The specific meaning can be referred to:
Http://www.cnblogs.com/sw926/p/3314165.html
Note that code obfuscation is only performed when your apk is signed, and you will not be confused during normal debugging.
Android code confuses those things