1. 程式人生 > >混淆規則

混淆規則

1) Proguard returned with error code 1. See console

  > 更新proguard版本
  > android-support-v4 不進行混淆
  > 新增缺少相應的庫

2) 使用gson包解析資料時,出現 missing type parameter 異常

  > 在 proguard-project.txt 中新增
    -dontobfuscate
    -dontoptimize
  > 在 proguard-project.txt 中新增
    # removes such information by default, so configure it to keep all of it.
    -keepattributes Signature 
    # 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.** { *; }

3) 型別轉換錯誤

  > 在 proguard-project.txt 中新增
    -keepattributes Signature

4) 空指標異常

  > 混淆過濾掉相關類與方法

5) java.lang.reflect.UndeclaredThrowableException

  > -keep interface com.dev.impl.**

6) Error: Unable to access jarfile ..libproguard.jar

  > 路徑問題

7) java.lang.NoSuchMethodError

  > 這也是最常見的問題,因為找不到相關方法,方法被混淆了,混淆過濾掉相關方法便可。