Afinal the jar package for code obfuscation error

Source: Internet
Author: User

Today, with the use of code confusion, the app can not run after the confusion, the old error, because the project only used afinal third-party library, so according to the answer on the Internet to not confuse afinal jar package, in the configuration file write the following statement:

-libraryjars Libs/afinal_0.5.1_bin.jar-dontwarn net.tsz.afinal.**-keep class net.tsz.afinal.** {*;}-keep public class * Extends net.tsz.afinal.**  -keep public interface net.tsz.afinal.** {*;}

But after the confusion of the package is still error, the error log shows a null pointer anomaly, turned over the code, only use the afinal of the finalactivity annotation to get the view, there may be the reason, and then Baidu Google to find the answer, the framework used the mechanism of reflection, So it is sometimes necessary to add the following statement:

-keepattributes signature-keepattributes *annotation*

Add after the confusion of the pass, and then check the configuration before and after, think about it is not much

Because at the top of the configuration file, a sentence has been added

-dontwarn

Then remove

Or not, to view the error log, as a result of introducing Android-support-v4.jar, add:

-dontwarn android.support.v4.**

OK, confusing pass, installed test, OK, also passed.

See online that there may be other problems, you need to add the following code:

-keepclasseswithmembers class xxx.** {     <fields>;      < Methods > ;}

Replace XXX with the name of the package name you inherited afinal.
Add these, basically is no problem!

Afinal the jar package for code obfuscation error

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.