1. Add configuration debug release package, so that the log log is captured, this way can tell the specific error (it is impossible to accurately determine which line it is)
/In the application tag of the file
Add the following configuration to log in the release package/
android:debuggable="true" tools:ignore="HardcodedDebugMode"
Everything is normal when the gson parsing is released, but when the release version is released, I found that all the parsed data is null.
Reason: Because obfuscation is used in the release version, and gson parsing the javabean required for parsing, I forgot to ignore the obfuscation, which caused it to be unable to parse normally after being obfuscated.
Solution: Add javabean to avoid confusion.
The javeBean to be ignored is a static inner class.
How to write: Write the absolute path of the class, the class name, $, and then the internal class name.
-keep class $StaticTest{ *; }
If it is a normal javeBean, just write the absolute path of the class and the class name;
-keep class { *; }
If you want to ignore all javaBeans under a package. Just write the path to the package;
-keep class .** { *; }
In mode, the app starts greendao and finds a null exception:
After a simple search, it pointed to the problem caused by greendao obfuscation, but checking the obfuscated configuration, there is already an obfuscated configuration:
-keep class .**{*;} -keepclassmembers class * extends { public static TABLENAME; } -keep class **$Properties
If it is ArrayIndexOutOfBoundsException, the obfuscation configuration needs to be adjusted to
-keep class .**{*;} -keep public class * extends -keepclassmembers class * extends { public static TABLENAME; } -keep class **$Properties -keepclassmembers class **$Properties {*;} #optional -keep class .**{*;} -keep public interface .** -dontwarn .** -dontwarn .**
This is the end of this article about the solution to the Android debug package crash when running normally. For more related content on Android release package crash, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!