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万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章