Caused by: Java. Lang. assertionerror: Illegal type variable reference solution

Source: Internet
Author: User
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 reference07-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

The error log is similar to a foreign friend. It has encountered this problem after obfuscation of proguard. This problem has been plagued for a long time, because many obfuscation issues have been found before, but the cause has not been found, finally, there is a solution.

You may need to add

-keepattributes EnclosingMethod

I was so excited with a useful answer. I tried it and it was okay .... Sahua ~~~ This sentence should be to protect internal classes ~~~

Finally, based on this clue, we found that we should add-keepattributes exceptions, innerclasses, signature, deprecated,
All the functions of sourcefile, linenumbertable, * annotation *, and enclosingmethod! This obfuscation should be okay.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.