Solution to the "conversion to Dalvik format failed with error 1" error when using proguard obfuscation code in Android

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.