In development environments later than Android, Google provides the proguard code obfuscation function (which can be added by yourself before) to protect the hard-to-write code.
The proguard. cfg file will be automatically added to the root directory of the newly created Project for code obfuscation. No matter which version of Android target you have created, it will be automatically added.
When you want to use code obfuscation. add proguard to the properties file. config = proguard. CFG indicates that you want to use code obfuscation. Some simple instructions can be found in the \ docs \ guide \ developing \ tools \ proguard.html file, there are also some precautions for using proguard, which can be found here.
For the old project, you can copy the corresponding proguard. cfg to achieve the same effect.
The "conversion to Dalvik format failed with error 1" error occurred during the obfuscation attempt today. The solutions found on the Internet are not for code obfuscation, later, I finally found the answer to the question in stackoverflow, because the problem with SDK tools reversion12 was reduced to reversion11, so there was no problem. A better solution was also provided:
Find the [Android SDK installation directory] \ tools \ proguard \ bin \ proguard. BAT file and open it in the editor (editplus is used:
Call % java_exe %-jar "% proguard_home %" \ Lib \ proguard. Jar % *
Change
Call % java_exe %-jar "% proguard_home %" \ Lib \ proguard. Jar % 1% 2% 3% 4% 5% 6% 7% 8% 9
OK.
I also encountered an error because I added a android-support-v4.jar to the project and learned to see if it is better compatible with different versions, but after adding this jar package, errors may occur during obfuscation. Someone said removing proguard. in CFG, the-optimizationpasses 5 statement can be solved, but I do not know much about proguard now. I do not know the specific meaning of each sentence, so I am afraid to delete it ~, Or wait for the study to understand and then decide whether to delete it.