googleads / googleads-mobile-unity

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

Google Mobile Ads Error - Is it compatible with unity version 2019.2.17f1? #2962

Closed lorenzostudiosok closed 11 months ago

lorenzostudiosok commented 1 year ago

Step 1: Describe your environment

Step 2: Describe the problem

Steps to reproduce:

I have an application in Unity, I update the Google Mobile Ads plugin to 8.5.2, then I implement all the ad events, it compiles correctly, but when I run the application on the emulator or real device, the application closes, with LogCat , I get the following error:

Relevant Code:


2023-10-02 17:35:35.430 18823-18823/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.orange.car.transform.racing, PID: 18823
    java.lang.IllegalAccessError: Field 'com.google.unity.ads.UnityRewardedAd.activity' is inaccessible to class 'com.google.unity.ads.UnityRewardedAd$1' (declaration of 'com.google.unity.ads.UnityRewardedAd$1' appears in /data/app/~~tf_kqTJMj-qSjuDQCPyGdQ==/com.orange.car.transform.racing-i-AiYpacIazBUZ0FP15aYg==/base.apk)
        at com.google.unity.ads.UnityRewardedAd$1.run(UnityRewardedAd.java:59)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
NVentimiglia commented 1 year ago

Hi @lorenzostudiosok

Google Mobile Ads for Unity is compatible with 2019.2.17f1, I just tested it to confirm.

Please update to the latest version and make sure the android dependency resolver succeeds.

lorenzostudiosok commented 1 year ago

Yes, the game resolves the libraries, compiles without errors, but on the device or emulator it gives me this error:

java.lang.IllegalAccessError: Field 'com.google.unity.ads.Interstitial.activity' is inaccessible to class 'com.google.unity.ads.Interstitial$1' (declaration of 'com.google.unity.ads.Interstitial$1' appears in /data/app/~~0eOqjMMjnnuzE3nqSvQFNA==/com.orange.car.transform.racing-2bzfXEJEXipTKqQ1yT_e3Q==/base.apk) at com.google.unity.ads.Interstitial$1.run(Interstitial.java:69) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7839) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

I have the graddle configured like this, does it have anything to do with it?

config_unity

NVentimiglia commented 1 year ago

@lorenzostudiosok

I used the gradle version installed with Unity.