Android code obfuscation causes problems, quick positioning

Source: Internet
Author: User

Code obfuscation causes problems, quick positioning

When the code is confusing, the third-party library is masked, and the normal Android obfuscation screen is used, but the resulting apk runs or crashes. There must be cause, and later analysis to find the reason is the use of Greendao automatically generated Java-gen under the package content is not masked code confusion, resulting in the storage of the database, reported *a (sourcefile:) NullPointerException *
Obfuscation package apk, run crash summary is as follows:

When we pack, the debug version is fine, but the release version sometimes crashes unexpectedly when confused.
For example:A (sourcefile:) NullPointerException

In this case, you can see the cause of the crash by grasping the Uncaughtexceptionhandler crash log or by a third party such as the Cloud tool. There is a better way to Androidstudio under the sun.

In Androidstudio can be set debug under also confusion, through the Android log intuitive, fast positioning problems
Set the following

Signingconfigs {release {} debug{}}} buildtypes {release {//Do not display logBuildconfigfield"Boolean","Log_debug","false"            //Turn on code obfuscationMinifyenabledtrue            //Remove useless resource filesShrinkresourcestrueProguardfiles Getdefaultproguardfile (' Proguard-android.txt '),' Proguard-rules.pro 'Signingconfig Signingconfigs.release//Use the above signature information}} debug {//Turn on code obfuscationMinifyenabledtrue            //Remove useless resource filesShrinkresourcestrueProguardfiles Getdefaultproguardfile (' Proguard-android.txt '),' Proguard-rules.pro 'Signingconfig Signingconfigs.debug}}

More questions please focus on Android development problems

Android code obfuscation causes problems, quick positioning

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.