After the project code that uses the afinal annotation is obfuscated, some view click events of some controls are invalid. afinalview

Source: Internet
Author: User

After the project code that uses the afinal annotation is obfuscated, some view click events of some controls are invalid. afinalview

Recently, a project was launched, requiring code obfuscation. After obfuscation, click events of some controls were invalid and were later found to be afinal annotations. After checking the materials for half a day, I asked the afinal related personnel about the solution they provided. The solution was to exclude the classes whose obfuscation was annotated. This means that basically all the activities and fragment cannot be confused, this is not what I want.

Later, the decompilation code ruled out the differences between the classes to be annotated and the classes to be annotated, and found that the definition code of those controls that cannot be clicked was optimized, the reason for the optimization is that after the annotation is used, the instance of the control in the Code is not used elsewhere, so the program considers that the Code is not used and is watched out.

If you know the problem, the solution will be available. Add-dontshrink to the obfuscation configuration so that the Code is not compressed and optimized. After adding it, you will find that the obfuscation code is not much higher than the original one, if you do not mind, you can only exclude annotated classes or do not use afinal annotations.

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.