googleads / googleads-consent-sdk-android

Consent SDK
https://developers.google.com/admob/android/eu-consent
Apache License 2.0
100 stars 82 forks source link

java.lang.RuntimeException: An error occured while executing doInBackground() #80

Open jinukjin opened 6 years ago

jinukjin commented 6 years ago

I had upload apk. google pre-launch-report catched bug. I don't know why is occured... please, help me.

07-23 22:27:33.108: E/AndroidRuntime(10419): FATAL EXCEPTION: AsyncTask #1 07-23 22:27:33.108: E/AndroidRuntime(10419): Process: us.kr.baseballnine, PID: 10419 07-23 22:27:33.108: E/AndroidRuntime(10419): java.lang.RuntimeException: An error occurred while executing doInBackground() 07-23 22:27:33.108: E/AndroidRuntime(10419): at android.os.AsyncTask$3.done(AsyncTask.java:330) 07-23 22:27:33.108: E/AndroidRuntime(10419): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) 07-23 22:27:33.108: E/AndroidRuntime(10419): at java.util.concurrent.FutureTask.setException(FutureTask.java:223) 07-23 22:27:33.108: E/AndroidRuntime(10419): at java.util.concurrent.FutureTask.run(FutureTask.java:242) 07-23 22:27:33.108: E/AndroidRuntime(10419): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:255) 07-23 22:27:33.108: E/AndroidRuntime(10419): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 07-23 22:27:33.108: E/AndroidRuntime(10419): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 07-23 22:27:33.108: E/AndroidRuntime(10419): at java.lang.Thread.run(Thread.java:776) 07-23 22:27:33.108: E/AndroidRuntime(10419): Caused by: java.lang.NoSuchMethodError: No direct method (Lcom/google/gson/Gson;)V in class Lcom/google/gson/Gson$1; or its super classes (declaration of 'com.google.gson.Gson$1' appears in /data/app/com.google.android.apps.mtaas.crawler-1/base.apk) 07-23 22:27:33.108: E/AndroidRuntime(10419): at com.google.gson.Gson.doubleAdapter(Gson.java:312) 07-23 22:27:33.108: E/AndroidRuntime(10419): at com.google.gson.Gson.(Gson.java:241) 07-23 22:27:33.108: E/AndroidRuntime(10419): at com.google.gson.Gson.(Gson.java:185) 07-23 22:27:33.108: E/AndroidRuntime(10419): at com.google.ads.consent.ConsentInformation.updateConsentData(ConsentInformation.java:386) 07-23 22:27:33.108: E/AndroidRuntime(10419): at com.google.ads.consent.ConsentInformation.access$000(ConsentInformation.java:47) 07-23 22:27:33.108: E/AndroidRuntime(10419): at com.google.ads.consent.ConsentInformation$ConsentInfoUpdateTask.makeConsentLookupRequest(ConsentInformation.java:242) 07-23 22:27:33.108: E/AndroidRuntime(10419): at com.google.ads.consent.ConsentInformation$ConsentInfoUpdateTask.doInBackground(ConsentInformation.java:272) 07-23 22:27:33.108: E/AndroidRuntime(10419): at com.google.ads.consent.ConsentInformation$ConsentInfoUpdateTask.doInBackground(ConsentInformation.java:189) 07-23 22:27:33.108: E/AndroidRuntime(10419): at android.os.AsyncTask$2.call(AsyncTask.java:316) 07-23 22:27:33.108: E/AndroidRuntime(10419): at java.util.concurrent.FutureTask.run(FutureTask.java:237) 07-23 22:27:33.108: E/AndroidRuntime(10419): ... 4 more 07-23 22:27:33.110: W/System.err(10419): org.json.JSONException: Value null of type org.json.JSONObject$1 cannot be converted to JSONObject

samlu commented 6 years ago

I got the same error today:

Caused by: java.lang.NoSuchMethodError: No direct method (Lcom/google/gson/Gson;)V in class Lcom/google/gson/Gson$1; or its super classes (declaration of 'com.google.gson.Gson$1' appears in /data/app/com.google.android.apps.mtaas.crawler-1/base.apk) at com.google.gson.Gson.doubleAdapter(Gson.java:312) at com.google.gson.Gson.(Gson.java:241) at com.google.gson.Gson.(Gson.java:185) at com.google.gson.Gson.(Gson.java:185) at com.google.ads.consent.ConsentInformation.updateConsentData(ConsentInformation.java:386)

venkat20390 commented 6 years ago

I have opened the same Issue 79.

Are you using Java 8 or Retrolambda in your project?

samlu commented 6 years ago

No. only Java 7 is used. The same build script, linked libraries, and environment for my app. No such issue for the new build apk that I uploaded to Play beta last week. I also don't see the crash issues on my devices. Currently, I only see the crash from Play's re-launch report since yesterday.

venkat20390 commented 6 years ago

I am also seeing the crash in Pre-launch report. I haven't rolled out the new version into production yet.

jinukjin commented 6 years ago

Me too. This is so frustrating.

venkat20390 commented 6 years ago

@jinukjin : I thought this issue is due to the recent migration to Java 8 in my project. But, it seems the @samlu is facing the issue even in Java 7.

Yes. It is frustrating.

jinukjin commented 6 years ago

@samlu @venkat20390 Hi! there. I found resolve the problem. This answer is worked for me. I hope it help.

https://stackoverflow.com/questions/47099757/pre-launch-report-failures-due-to-missing-methods-in-com-google-android-apps-mt?rq=1

samlu commented 6 years ago

Glad to know that the problem is not related to our code.

I also changed the source code of ConsentInformation.java #248 from } catch (Exception e) { to } catch (Throwable e) { in case it happens on user devices. FYI.

venkat20390 commented 6 years ago

@jinukjin Thanks for pointing me to that SO thread. For me the "Enable Pre-launch Report" was turned on already. Am i missing something?

Btw, I have released my app in a stagged rollout and haven't come across any crash in the real user devices.

@samlu : Yes, I am planning to do that on the next update.

vik17ag commented 6 years ago

I changed ConsentInformation.java #248 as suggested by @samlu .

In addition, I added the logic in the method - onFailedToUpdateConsentInfo() when calling requestConsentInfoUpdate () since, it should not miss out calling the consent dialog if it fails to get the consent data. But , I wonder how many devices get this error.

Following are the logs which show the throwable

W/CrashlyticsCore: Expected method missing: java.lang.NoSuchMethodException: parameter type is null at java.lang.Class.getMethod(Class.java:2060) at java.lang.Class.getDeclaredMethod(Class.java:2047) at com.crashlytics.android.core.DefaultAppMeasurementEventListenerRegistrar.invoke(SourceFile:89) at com.crashlytics.android.core.DefaultAppMeasurementEventListenerRegistrar.register(SourceFile:54) at com.crashlytics.android.core.CrashlyticsController.registerAnalyticsEventListener(SourceFile:1574) at com.crashlytics.android.core.CrashlyticsCore.doInBackground(SourceFile:320) at com.crashlytics.android.core.CrashlyticsCore.doInBackground(SourceFile:44) at io.a.a.a.h.a(SourceFile:63) at io.a.a.a.h.a(SourceFile:28) at io.a.a.a.a.c.a$2.call(SourceFile:311) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764)