Confuse
Android Studio:
Just add the compile option for release in the Buildtypes in Build.gradle (Module:app), as follows:
buildTypes { release { true proguardFiles getDefaultProguardFile(‘proguard-android.txt‘‘proguard-rules.pro‘ } }
This proguard-android.txt is the Groguard default file in the SDK, specific address:/opt/sdk/tools/proguard/proguard-android.txt
And Proguard-rules.pro is a dedicated Proguard configuration file in the AS, in fact, only the suffix name is different, and the proguard-project.txt in Eclipse is the same, the configuration rules are the same, the following will be mentioned in detail.
The old version of the command to open confusion is Runproguard, now unified with the minifyenabled command, set it to true is good.
The command can be used when compiling:
./gradlew assembleRelease
Or you can use the previous method to generate a signature apk.
Eclipse:
Open the Proguard configuration (release comment) in the project.properties file as follows:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
Similarly, the code is confused when the signature is generated.
confusing Syntax
Please refer to the ${sdk.dir}/tools/proguard/proguard-android.txt file, note that although there is no confusion in the file parcelable statements, as follows:
class * implements android.os.Parcelable { publicstaticfinal android.os.Parcelable$Creator *;}
However, you still have to write the class that inherits from Parcelable in order to avoid confusion, otherwise there will be badparcelableexception exception.
com.linc.datatype.XXInfo {*;}
To verify that the confusion is successful, you can use the following anti-compilation tool to verify.
Anti-compilation
The main use of the three tools:
Dex2jar: Converting a dex file to a jar file
Jd-gui: Anti-compilation jar file
Axmlprinter2.jar: decompile XML file
How to use the "anti-compilation apk file, get its source code method"
For Ubuntu64 bits, running Jd-gui may error:
Try to resolve the following:
$ sudo apt-get install libgtk2 .0-0 :i386 LIBNSS3 :i386 libcurl3-gnutls :i386 libidn11 :i386 libpango1 .0-0 :i386 libpangox-1 .0-0 :i386 libpangoxft-1 .0-0 :i386 librtmp0 :i386 libxft2 :i386
Also error:
whileshared libraries: libXxf86vm.so.1opensharedfilefileor directory
The solution is as follows:
sudoapt-getinstalllibgtk2.0-0:i386libxxf86vm1:i386libsm6:i386lib32stdc++6
Reference:
http://blog.csdn.net/lincyang/article/details/6333974
Android 14: Confusing and anti-compilation