Caused by: java.lang.AssertionError: illegal type variable reference 解决办法

07-24 10:54:13.529: E/AndroidRuntime(12130): FATAL EXCEPTION: AsyncTask #3

07-24 10:54:13.529: E/AndroidRuntime(12130): java.lang.RuntimeException: An error occured while executing doInBackground()

07-24 10:54:13.529: E/AndroidRuntime(12130): at android.os.AsyncTask$3.done(AsyncTask.java:299)

07-24 10:54:13.529: E/AndroidRuntime(12130): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)

07-24 10:54:13.529: E/AndroidRuntime(12130): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)

07-24 10:54:13.529: E/AndroidRuntime(12130): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)

07-24 10:54:13.529: E/AndroidRuntime(12130): at java.util.concurrent.FutureTask.run(FutureTask.java:137)

07-24 10:54:13.529: E/AndroidRuntime(12130): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)

07-24 10:54:13.529: E/AndroidRuntime(12130): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)

07-24 10:54:13.529: E/AndroidRuntime(12130): at java.lang.Thread.run(Thread.java:856)

07-24 10:54:13.529: E/AndroidRuntime(12130): Caused by: java.lang.AssertionError: illegal type variable reference

07-24 10:54:13.529: E/AndroidRuntime(12130): at org.apache.harmony.luni.lang.reflect.ImplForVariable.resolve(ImplForVariable.java:113)

07-24 10:54:13.529: E/AndroidRuntime(12130): at org.apache.harmony.luni.lang.reflect.ImplForVariable.getGenericDeclaration(ImplForVariable.java:127)

07-24 10:54:13.529: E/AndroidRuntime(12130): at org.apache.harmony.luni.lang.reflect.ImplForVariable.hashCode(ImplForVariable.java:46)

07-24 10:54:13.529: E/AndroidRuntime(12130): at java.util.Arrays.hashCode(Arrays.java:1260)

07-24 10:54:13.529: E/AndroidRuntime(12130): at com.google.gson.internal.$Gson$Types$ParameterizedTypeImpl.hashCode(SourceFile:475)

07-24 10:54:13.529: E/AndroidRuntime(12130): at com.google.gson.reflect.TypeToken.(SourceFile:64)

07-24 10:54:13.529: E/AndroidRuntime(12130): at com.gaozhi.wh.asynctask.MyAsyncTask$2$1.(SourceFile:78)

07-24 10:54:13.529: E/AndroidRuntime(12130): at com.gaozhi.wh.asynctask.MyAsyncTask$2.call(SourceFile:78)

07-24 10:54:13.529: E/AndroidRuntime(12130): at com.gaozhi.wh.asynctask.MyAsyncTask$2.call(SourceFile:1)

07-24 10:54:13.529: E/AndroidRuntime(12130): at com.gaozhi.wh.utils.async.AsyncTaskUtils$2.doInBackground(SourceFile:114)

07-24 10:54:13.529: E/AndroidRuntime(12130): at com.gaozhi.wh.utils.async.AsyncTaskUtils$2.doInBackground(SourceFile:1)

07-24 10:54:13.529: E/AndroidRuntime(12130): at android.os.AsyncTask$2.call(AsyncTask.java:287)

07-24 10:54:13.529: E/AndroidRuntime(12130): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 07-24 10:54:13.529: E/AndroidRuntime(12130): ... 4 more

错误日志类似国外这位朋友,也是在混淆 proguard后遇到这个问题,这个问题困扰很久了,因为之前也排查了很多混淆要注意的东西,但是一直没有查到原因,这次终于有解决办法了。

You may need to add

-keepattributes EnclosingMethod
有用的回答就这么一句,让我好激动,我一试,果然可以了。。。。撒花~~~这句话应该是把内部类保护起来~~~

最后根据这个线索就查到了应该添加-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
                SourceFile,LineNumberTable,*Annotation*,EnclosingMethod 这些全部的功能!这样混淆就应该没问题了。




你可能感兴趣的:(Android)