about theAndroidStudio Packaging obfuscation and uploading mapping files
Reprint please specify the source:
Http://blog.csdn.net/u014163726?viewmode=contents
This article is from WRH's blog
Packaged
Android Studio is easy to package
Then if there is already keystore all the way next down, if there is no need to first create the KeyStore, finally we will get an APK file
Confuse
Now online about anti-compilation blog A lot of, I do not do more introduction, put a portal portal
So we already know that anti-compilation is so simple, we always do not want their hard-written code is so easily decompile, and it is possible to leave the company's servers to be attacked, then we can use confusion to protect the code we write
Android Studio Obfuscation is almost identical to eclipse.
| name |
function |
| Minifyenabled |
Whether to turn on confusion |
| Shrinkresources |
Removal of useless resource files |
| Proguardfiles Getdefaultproguardfile |
Load Obfuscation configuration file |
If you follow the default obfuscation rules it is likely that your program will error, because it confuses some methods so that the method cannot be found during the run of the program. So we should customize some rules in Proguard-rules.pro.
The following template information comes from the online
Specify the compression level of the Code
-optimizationpasses 5
Baoming not mixed case
-dontusemixedcaseclassnames
Do not ignore non-public library classes
-dontskipnonpubliclibraryclasses
Optimizing class files that do not optimize input
-dontoptimize
Pre-calibration
-dontpreverify
Whether logs are logged when confused
-verbose
The algorithm used in the confusion
-optimizations!code/simplification/arithmetic,!field/,!class/merging/
Protection annotations
-keepattributesAnnotation
Keep What classes are not confused
-keep public class * extends Android.app.Fragment
-keep public class * extends Android.app.Activity
-keep public class * extends Android.app.Application
-keep public class * extends Android.app.Service
-keep public class * extends Android.content.BroadcastReceiver
-keep public class * extends Android.content.ContentProvider
-keep public class * extends Android.app.backup.BackupAgentHelper
-keep public class * extends Android.preference.Preference
-keep public class Com.android.vending.licensing.ILicensingService
If you have a reference V4 package, you can add the following line
-keep public class * extends Android.support.v4.app.Fragment
Ignore warnings
-ignorewarning
Logs generated log data, Gradle build at the root of this project output
The internal structure of all classes within the APK package
-dump Class_files.txt
Non-confusing classes and members
-printseeds Seeds.txt
List the code that was removed from the APK
-printusage Unused.txt
The mapping before and after confusion
-printmapping Mapping.txt
Mapping file
Mapping.txt
Lists the original classes, method and field names, and the mappings between the code after the confusion. This file is important, and you can use it to translate the obfuscated code when you receive a bug report from the release release.
Mapping directory in\app\build\outputs\mapping\release
Test
Ok,bye
About Android Studio packaging obfuscation and uploading mapping files