gradle混淆錯誤查詢

Android proGuard Summary

org.xmlpull.v1.XmlPullParser

-dontwarn org.xmlpull.v1.**

該問題是由於Libs中存在系統相同的xml解析類,需要將libs中衝突的文件刪除,該問題同樣會導致 can not parse the litepal.xml, check if it’s in correct format的問題產生

OSMdroid的混淆

-keep public class * extends android.view.View {
   public <init>(android.content.Context);
   public <init>(android.content.Context, android.util.AttributeSet);
   public <init>(android.content.Context, android.util.AttributeSet, int);
   public void set*(...);
}

-keep class microsoft.mappoint.** {*;}
-keep class org.osmdroid.** {*;}
-keep class org.metalev.multitouch.controller.** {*;}

LitePal的錯誤總結

DatabaseGenerateException

可能會在生成表或者更新表的時候拋出。列出常見異常:

1. can not find a class named
2. An exception that indicates there was an error with SQL parsing or execution.
3. SQL syntax error happens while executing
4. Table doesn't exist when executing
5. Table doesn't exist with the name of

DataSupportException

可能會在GRUD操作的時候拋出。列出常見異常:

1. id type is not supported. Only int or long is acceptable for id
2. should be inherited from DataSupport
3. The field to declare many2one or many2many associations should be List or Set.
4. Save current model failed.
5. needs a default constructor.
6. The parameters in conditions are incorrect.

GlobalException

全局異常,沒有繼承LitePalApplication,或者在自定義Application中調用initialize方法。
Application context is null. Maybe you haven't configured your application name with \"org.litepal.LitePalApplication\" in your AndroidManifest.xml. Or you can call LitePalApplication.initialize(Context) method instead.

InvalidAttributesException

非法屬性引發的異常,列出常見異常:
1. dbname is empty or not defined in litepal.xml file
2. the version of database can not be less than 1
3. the version in litepal.xml is earlier than the current version
4. is an invalid value for <cases></cases>

ParseConfigurationFileException

LitePal默認使用SAX解析xml文件,所以解析異常有可能會拋出:
1. litepal.xml file is missing. Please ensure it under assets folder
2. can not parse the litepal.xml, check if it's in correct format
3. parse configuration is failed
4. IO exception happened

GSON混淆

# removes such information by default, so configure it to keep all of it.
-keepattributes Signature
-keepattributes *Annotation*
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }
-keep class com.google.gson.** { *;}
#這句非常重要,主要是濾掉 Gson需要的.class文件不進行混淆編譯
-keep class gnss.ubinavi.upload.UpdateInfo { *; }
-keep class gnss.ubinavi.upload.UpdateInfoDao { *; }

不混淆資源類

-keepclassmembers class **.R$* {
    public static <fields>;
}

V4包

-keep class android.support.v4.** { *; }
-keep public class * extends android.support.v4.**
-keep public class * extends android.app.Fragment

LitePal

-keep class org.litepal.** { *; }
-keep class * extends org.litepal.crud.DataSupport { *; }

Unkonw soruce

避免出現Bug後提示信息爲Unkonw soruce

-keepattributes SourceFile,LineNumberTable

apache.http

-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**
-dontwarn android.net.**
發佈了37 篇原創文章 · 獲贊 5 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章