googleads / googleads-mobile-unity

Official Unity Plugin for the Google Mobile Ads SDK
https://developers.google.com/admob/unity
Apache License 2.0
1.38k stars 1.08k forks source link

com.google.unity.ump.UnityConsentFormCallback class not found #2896

Closed mrcece closed 1 year ago

mrcece commented 1 year ago

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

I implemented UMP to show GDPR message I've created on Admob panel. I followed the Admob's doc but I got this error message on LogCat: AndroidJavaException: java.lang.ClassNotFoundException: com.google.unity.ump.UnityConsentFormCallback

NVentimiglia commented 1 year ago

Confirmed the issue, thank you for the report.

kassen-ereve commented 1 year ago

I encountered the same error using v8.5.2. @mrcece when you tested in an actual device did the consent dialogue appear? I tried on mine but its not appearing even after adding the hash device id. Im trying to figure out if the com.google.unity.ump.UnityConsentFormCallback is the cause of it not appearing or not

mrcece commented 1 year ago

There is noting, just error on actual device.

kassen-ereve commented 1 year ago

Same result. Looks like v8.5.2 is fully broken.

kassen-ereve commented 1 year ago

@mrcece what version are you now using? Is v8.5.1 fine and doesnt have this error? I need the consent asap and it loooks like the fix for v8.5.2 would take another two weeks to be released

mrcece commented 1 year ago

I don't know. It is firt time to try

umitcankomur commented 1 year ago

Adding -keep class com.google.unity.** {*;} to the custom proguard file solved the issue for me.

GeorgesGraire commented 1 year ago

Adding -keep class com.google.unity.** {*;} to the custom proguard file solved the issue for me.

I have the same problem as the others, and adding this line to the proguard file didn't help. @NVentimiglia

image

In the Unity logs, not error is raised but actual validation logs:

image

umitcankomur commented 1 year ago

Adding -keep class com.google.unity.** {*;} to the custom proguard file solved the issue for me.

I have the same problem as the others, and adding this line to the proguard file didn't help. @NVentimiglia

image

In the Unity logs, not error is raised but actual validation logs:

image

These are all the proguard rules I added. -keep class com.google.unity.ads.** { *; } -keep public class com.google.android.gms.ads.**{ public *; } -keep public class com.google.ads.**{ public *; } -keep public class com.google.android.ump.**{ public *; } -keep class com.google.ads.consent.** { <fields>; } -keep class com.google.unity.** { *; } -keepattributes *Annotation* -keepattributes Signature

GeorgesGraire commented 1 year ago

Adding -keep class com.google.unity.** {*;} to the custom proguard file solved the issue for me.

I have the same problem as the others, and adding this line to the proguard file didn't help. @NVentimiglia image In the Unity logs, not error is raised but actual validation logs: image

These are all the proguard rules I added. -keep class com.google.unity.ads.** { *; } -keep public class com.google.android.gms.ads.**{ public *; } -keep public class com.google.ads.**{ public *; } -keep public class com.google.android.ump.**{ public *; } -keep class com.google.ads.consent.** { <fields>; } -keep class com.google.unity.** { *; } -keepattributes *Annotation* -keepattributes Signature

Unfortunately still the same error, I wonder why it works on your side and not mine. Also it's my first time implementing the AdMob GDPR consent form so maybe I'm doing something wrong. I'm relying on the the sample scripts.

mrcece commented 1 year ago

@GeorgesGraire I updated my project to 2022.3.8 then it works. Problem is about openjdk because External dependency tool cant find the right libraries.

GeorgesGraire commented 1 year ago

@GeorgesGraire I updated my project to 2022.3.8 then it works. Problem is about openjdk because External dependency tool cant find the right libraries.

Thanks! I updated Unity to the latest 2022.3.8 LTS version and the consent form is now displayed.

kassen-ereve commented 1 year ago

Its not working on latest 2021 LTS release

NVentimiglia commented 1 year ago

Hi Everyone,

We think this issue may be a caching issue related to upgrading from 8.5.1. I was able to replicate this issue at first on my end, but by deleting my Assets/Plugins folder and reinstalling the plugin, I solved the issue.

If anyone else runs into this issue again, please feel free to reopen this issue and ping me.

rO5h commented 1 year ago

@NVentimiglia Still getting this error. I tried adding all the rules mentioned above to the custom proguard file, I tried deleting the plugins folder and reinstalling it. I'm using unity version 2023.1.5f1 and google mobile ads 8.5.2

gollobo commented 1 year ago

@rO5h try a Clean Build after deleting the admob files in plugins folder and reinstalling it, solved the issue for me.

JenzSahlin commented 1 year ago

We had the same problem! We cleared the cache from the library folder and after that it worked!

dginovker commented 1 year ago

Deleted Library folder and updated proguard files, but still getting java.lang.ClassNotFoundException: com.google.unity.ump.UnityConsentFormCallback. Upgrading Unity isn't an option, since our project is quite large and we can't afford random things breaking. We also can't simply delete the whole Android/Plugins folder, since we have a lot of various plugins in there.

Keyden commented 1 year ago

update to unity2021.3.32 solve this problem

Seanm07 commented 1 year ago

I'm still getting this issue in the 8.5.3 release of the plugin, previously the project was using 8.4.1 and I deleted the GoogleMobileAds and Plugins folder before updating.

I've tried force resolving, doing a clean build, adding proguard rules mentioned in here. I'm using Unity 2022.2.20f1 with google version handler 1.2.177

This is the full error I'm getting when trying to call ConsentInformation.Update:

AndroidJavaException: java.lang.ClassNotFoundException: com.google.unity.ump.UnityConsentFormCallback java.lang.ClassNotFoundException: com.google.unity.ump.UnityConsentFormCallback at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:453) at com.unity3d.player.ReflectionHelper.nativeProxyInvoke(Native Method) at com.unity3d.player.ReflectionHelper.-$$Nest$smnativeProxyInvoke(Unknown Source:0) at com.unity3d.player.ReflectionHelper$a.invoke(Unknown Source:29) at java.lang.reflect.Proxy.invoke(Proxy.java:913) at $Proxy13.onConsentInfoUpdateSuccess(Unknown Source) at com.google.android.gms.internal.consent_sdk.zzt.run(Unknown Source:2) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6944) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:3

Strangely I can confirm the class com.google.unity.ump.UnityConsentFormCallback is inside Assets/Plugins/Android/googlemobileads-unity.aar but inspecting a built apk in android studio the folders com/google/unity/ump is not inside any of the classes.dex

fightaway commented 1 year ago

@NVentimiglia I still face this problem

juaprebo commented 10 months ago

Hi @NVentimiglia, I'm getting this error instead: Error calling loadAndShowConsentFormIfRequired: java.lang.NoSuchMethodError: No static method loadAndShowConsentFormIfRequired(Landroid/app/Activity;Lcom/google/android/ump/ConsentForm$OnConsentFormDismissedListener;)V in class Lcom/google/android/ump/UserMessagingPlatform; or its super classes (declaration of 'com.google.android.ump.UserMessagingPlatform' appears in /data/app/com.codigames.idle.police.department.tycoon.cop-gZFnL55G4WNFyXudceTtfw==/base.apk!classes3.dex)

I'm on Unity 2020.3.20f1 (there Is not possible to update) and GoogleMobileAdsPlugin version 8.7.0. Thank you.

bit-man commented 8 months ago

Just to let you know that if this failure occurs at Gitlab CI cleaning runners cache did the trick for me (Clear runner caches button)