I have followed the guide from documentation and implemented the SDK in my app. I got the following crash report in Firebase.
Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'c.d.b.c.e.d.y c.d.b.c.e.d.w1.c' on a null object reference
at com.google.android.gms.internal.consent_sdk.zzj.isConsentFormAvailable(zzj.java:13)
at [my_app_package].MainActivity$1.onConsentInfoUpdateSuccess(MainActivity.java:1035)
at com.google.android.gms.internal.consent_sdk.zzu.run(zzu.java:4)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:239)
at android.app.ActivityThread.main(ActivityThread.java:8142)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015)
Anyone is getting the same problem?
The first line is obfuscated. I think the crash is because of the internal SDK issue. Anyone knows how to fix this?
FIX:
When I followed the guide as it is, I was getting memory leak. So, I passed getApplicationContext() to UserMessagingPlatform.getConsentInformation(). This is the reason why the app is getting crashed. Instead, I passed this (Activity context). Everything is fine now. To avoid memory leak, assign null to consentInformation and consentForm variables in the onDestroy() method. It worked for me.
I encountered crash in calling isConsentFormAvailable() too:
Turns out the following proguard rules are needed to fix the crash:
Similar rules exist in old consent SDK.