In Android Studio, the self-contained anti-compilation view class file, if not confused, class files and Java files basically no difference, in order to protect, or confusing good.
Online read a lot of information, are directly download Proguard extra jar, directly generated, feel inconvenient, since the apk can be confused, why not directly through the Android studio to confuse the jar package it.
The procedure is actually very simple, a build file, a Proguard file can be.
The first thing to understand is where the jar came from, previously in Eclipse, a project was set up as a library, and then another master project relied on it. Build, the jar file will be generated in the library.
The concept of module in Android Studio is actually equivalent to project. The main app module relies on other sub-module, which, when packaged, will make the other module an AAR and assign it to the main app. So the jar is for the entire module to make.
If the module is just Java code, it is no problem to generate the jar, but if there is a resource file, you will have to hit the AAR file.
In the module build file where you want to hit the jar package, add a task that generates the jar package. In fact, even if not added, the entire project build will also generate the jar file. Can be found in Build/intermediates/bundles/release/classes.jar. It's just not confusing.
Task Makejar (Type:proguard.gradle.ProGuardTask, DependsOn: "Build") {
Non-confusing Jar
Injars ' Build/intermediates/bundles/release/classes.jar '
Confused Jar path
Outjars ' Build/http.jar '
Specific need to keep live class
Configuration ' Proguard-rules.pro '
}
This time, in the termial in the input./gradlew Makejar will be able to classes.jar copy down Http.jar. This time is still not confused, because the confusion is not written at all.
If the module also relies on other libs, it is necessary to declare those libs in the Proguard. For example: #-libraryjars Libs\gson-2.2.2.jar, most are confused with the apk similar, but is limited to a module only.
With a proguard for everyone to refer to, but also online search. The end result is not very good, but simply to change part of the variable to ABCD, but also enough. It's not always possible to confuse methods, so external calls are troublesome.
Proguard-rules.pro
Android Studio Export jar package and confuse