Android code obfuscation can ' t find referenced class problem solution

Source: Internet
Author: User

The previous article describes Android using Proguard code obfuscation technology, but for some of the items that introduced third-party jar packages may be in error when exporting, you need to do some research on the Proguard configuration file to solve the problem.

Proguard code obfuscation after exporting warning:can ' t find referenced class

First, this time the simplest solution:

For some third-party jars, there may have been code confusion, which should be maintained here, such as Baidu's map package jar. Keep the jar, avoid confusing the code as follows:

-keep class com.baidu.mapapi.** {*;}

Does not confuse all the code in the Com.baidu.mapapi package, the class name, method, variable, and so on.

Second, if it is still an error, please refer to this article: http://blog.csdn.net/u_xtian/article/details/7495023

Thank the author here, solve my problem, in fact, the final solution is very simple, add two lines is good:

In fact, can not find the reference to this class is a third-party package inside, and many times we just need to disrupt their own code on the line, the third-party package of the code is to be disrupted on the tube.

We can use:

-dontwarn com.xx.bbb.**
-keep class com.xx.bbb.** {*;}

Parameters to keep classes in third-party libraries without confusion,-dontwarn and-keep, meaning to keep com.xx.bbb.** all the classes and all the methods in this package are not confused, and then called Proguard do not warn you can't find com.xx.bbb.** A reference to the class within the package .

After configuration, repack, everything ok! And the program can run correctly.


The above is the error I encountered when writing a confusing configuration file solution

I developed a profile that uses ant bulk packaging obfuscation in the project has uploaded click Open link

http://download.csdn.net/detail/fancylovejava/8551463

Record, and then do other projects in bulk packaging when you can learn from the next!



Android code obfuscation can ' t find referenced class problem solution

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.