Android code obfuscation causes problems, fast locating, and android Obfuscation

Source: Internet
Author: User

Android code obfuscation causes problems, fast locating, and android Obfuscation
Problems caused by code obfuscation and quick locating

During code obfuscation and packaging, the third-party libraries used and the conventional android obfuscation and shielding are blocked, but the generated apk will crash during running. There is a reason for the event, and the reason found later isThe content in the package under the java-gen automatically generated using greendao does not block code obfuscation, resulting in a report when the database is stored.* A (SourceFile :) NullPointerException *
To package the apk in obfuscation mode, the running crash is summarized as follows:

The debug version is okay during packaging, but after obfuscation, the release version sometimes suffers an exception and crashes,
For example:A (SourceFile :) NullPointerException

In this case, you can view the cause of the crash by capturing the UncaughtExceptionHandler crash log or a third-party cloud testing tool, such as cloud testing. There is also a better method under androidstudio.

In androidstudio, you can set debugging and obfuscation. You can use android log to intuitively and quickly locate the problem.
The settings are as follows:

SigningConfigs {release {} debug {}}} buildTypes {release {// Log buildConfigField "boolean", "LOG_DEBUG ", "false" // Enable code obfuscation minifyEnabled true // Remove useless resource files shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt '), 'proguard-rules. pro 'signingconfig signingConfigs. release // use the above signature information} debug {// Enable code obfuscation minifyEnabled true // Remove useless resource files shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt '), 'proguard-rules. pro 'signingconfig signingConfigs. debug }}

For more questions, please pay attention to issues encountered in android Development

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.