Afinal jar package for code obfuscation error, afinaljar code obfuscation

Source: Internet
Author: User

Afinal jar package for code obfuscation error, afinaljar code obfuscation

Code obfuscation is used today. After the obfuscation, the APP cannot run and an error is reported. Because the project only uses the third-party libraries of Afinal, the answers provided on the Internet are used to avoid obfuscation of the jar package of Afinal, the following statement is written into the configuration file:

-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.** {*;}

However, the obfuscated package still reports an error. The error log shows a null pointer exception, turning the code and obtaining the View only using the FinalActivity annotation of Afinal, this may be the reason, So Baidu and Google used the reflection mechanism to find the answer. Therefore, we sometimes need to add the following statement:

-keepattributes Signature-keepattributes *Annotation*

After the addition, the obfuscation is not passed, and then check the configuration before and after, and wonder if there is more

-dontwarn 

Because the configuration file has already been prefixed

-dontwarn

So remove

-dontwarn 

Still not good, view the error log, because the introduction of android-support-v4.jar, so add:

-dontwarn android.support.v4.**

OK, mixed pass, installation test, OK, also passed.

If you see other problems on the internet, you need to add the following code:

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

Replace xxx with the package name and Class Name of your inherited afinal.
In addition, there is basically no problem!

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.