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

Interstital and Rewarded Video Error from the Latest "GoogleMobileAds-native" plugin #1740

Closed dareerahmadmufti closed 1 year ago

dareerahmadmufti commented 3 years ago

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

When I request for interstitial and rewarded video ad from the Admob plugin (Native supported one), the app crashes. Only banner ads and native ad are working in this.

Steps to reproduce:

Just import the "GoogleMobileAds-native"(native supported plugin) request and call for interstitial ads and problem will occur

=> LOGS: When I do request: AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/InterstitialAd; 08-17 11:36:29.568 9844 9844 E Unity : java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/InterstitialAd; 08-17 11:36:29.568 9844 9844 E Unity : at com.google.unity.ads.Interstitial$1.run(Interstitial.java:69) 08-17 11:36:29.568 9844 9844 E Unity : at android.app.Activity.runOnUiThread(Activity.java:6298) 08-17 11:36:29.568 9844 9844 E Unity : at com.google.unity.ads.Interstitial.create(Interstitial.java:66) 08-17 11:36:29.568 9844 9844 E Unity : at com.unity3d.player.ReflectionHelper.nativeProxyInvoke(Native Method) 08-17 11:36:29.568 9844 9844 E Unity : at com.unity3d.player.ReflectionHelper.a(Unknown Source:0) 08-17 11:36:29.568 9844 9844 E Unity : at com.unity3d.player.ReflectionHelper$1.invoke(Unknown Source:31) 08-17 11:36:29.568 9844 9844 E Unity : at java.lang.reflect.Proxy.invoke(Proxy.java:1006) 08-17 11:36:29.568 9844 9844 E Unity : at $Proxy13.onInitializationComplete(Unknown Source) 08-17 11:36:29.568 9844 9844 E Unity : at com.google.android.gms.internal.ads.zzbdx.zzb(com.google.android.gms:play-services-ads-lite@@20.2.0:5) 08-17 11:36:29.568 9844 9844 E Unity : at com.google.android.gms.internal.ads.zzbnp.zzbK(com.google.android.gms:play-services-ads-lite@@20.2.0:2) 08-17 11:36:29.568 9844 9844 E Unity : at com.google.android.gms.internal.ads.zzhr.onTransact(com.google.android.gms:play-service

=>LOGS: When we call to show the ad AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/InterstitialAd; 08-17 11:42:56.121 9844 9871 E Unity : java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/InterstitialAd; 08-17 11:42:56.121 9844 9871 E Unity : at java.lang.reflect.Executable.getMethodReturnTypeInternal(Native Method) 08-17 11:42:56.121 9844 9871 E Unity : at java.lang.reflect.Method.getReturnType(Method.java:148) 08-17 11:42:56.121 9844 9871 E Unity : at java.lang.Class.getDeclaredMethods(Class.java:1880) 08-17 11:42:56.121 9844 9871 E Unity : at com.unity3d.player.ReflectionHelper.getMethodID(Unknown Source:34) 08-17 11:42:56.121 9844 9871 E Unity : at com.unity3d.player.UnityPlayer.nativeRender(Native Method) 08-17 11:42:56.121 9844 9871 E Unity : at com.unity3d.player.UnityPlayer.c(Unknown Source:0) 08-17 11:42:56.121 9844 9871 E Unity : at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95) 08-17 11:42:56.121 9844 9871 E Unity : at android.os.Handler.dispatchMessage(Handler.java:102) 08-17 11:42:56.121 9844 9871 E Unity : at android.os.Looper.loop(Looper.java:205) 08-17 11:42:56.121 9844 9871 E Unity : at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20) 08-17 11:42:56.121 9844 9871 E Unity : Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.InterstitialAd" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar",

Relevant Code:

=> For interstitial request

    //method
    public void RequestInterstitial() {

      // Clean up interstitial ad before creating a new one.
      if (this.interstitial != null) {
          this.interstitial.Destroy();
      }

      // Create an interstitial.
      this.interstitial = new GoogleMobileAds.Api.InterstitialAd(Admob_Interstitial_ID);

      // Register for ad events.
      // Called when an ad request has successfully loaded.
      this.interstitial.OnAdLoaded += HandleOnAdLoaded;
      // Called when an ad request failed to load.
      this.interstitial.OnAdFailedToLoad += HandleOnAdFailedToLoad;
      // Called when an ad is shown.
      this.interstitial.OnAdOpening += HandleOnAdOpened;
      // Called when the ad is closed.
      this.interstitial.OnAdClosed += HandleOnAdClosed;

      // Load an interstitial ad.
      this.interstitial.LoadAd(this.CreateAdRequest());
  }

  //for interstitial calling
  public void ShowInterstitial() {

          if(this.interstitial.IsLoaded())
             this.interstitial.Show();
      }

=> In gradle file: classpath 'com.android.tools.build:gradle:3.4.3'

DenisShockapp commented 3 years ago

The same problem. The latest available version of GoogleMobileAds-native does not work with Play-Services-20.0.0. But this works fine with the Play-Services version-19.7.0.

Play Services Resolver automatically integrates Play-Services-20.0.0 version. And it does not allow to roll back.

We need an updated version of GoogleMobileAds-native with support for Play-Services-20.0.0. But I couldn't find it. Maybe they forgot to update it.

mana-break commented 3 years ago

Please update the GoogleMobileAds-native plugin. I have been waiting for 3 months since 6.0.0 was released😥

NVentimiglia commented 3 years ago

GoogleMobileAds-native plugin support for Play-Services-20.0.0 is a priority.

mana-break commented 3 years ago

Hi! Any news? 4 months have passed since v6.0.0

mry-ship commented 3 years ago

The same problem. load rewardads crash so much

mana-break commented 2 years ago

8 months have passed since v6.0.0

lucid-dreamm commented 2 years ago

What is the problem? Why isn't it solved? :/ Initialized successfully When requesting a video ad:

2022/03/11 21:44:42.128 19921 19921 Error AndroidRuntime java.lang.InstantiationError: com.google.android.gms.ads.rewarded.RewardedAd
2022/03/11 21:44:42.128 19921 19921 Error AndroidRuntime    at com.google.unity.ads.UnityRewardedAd$1.run(UnityRewardedAd.java:53)
2022/03/11 21:44:42.128 19921 19921 Error AndroidRuntime    at android.os.Handler.handleCallback(Handler.java:808)
2022/03/11 21:44:42.128 19921 19921 Error AndroidRuntime    at android.os.Handler.dispatchMessage(Handler.java:101)
2022/03/11 21:44:42.128 19921 19921 Error AndroidRuntime    at android.os.Looper.loop(Looper.java:166)
2022/03/11 21:44:42.128 19921 19921 Error AndroidRuntime    at android.app.ActivityThread.main(ActivityThread.java:7529)
2022/03/11 21:44:42.128 19921 19921 Error AndroidRuntime    at java.lang.reflect.Method.invoke(Native Method)
2022/03/11 21:44:42.128 19921 19921 Error AndroidRuntime    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
2022/03/11 21:44:42.128 19921 19921 Error AndroidRuntime    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
Unity: 2019.4
Platform: Android
GooglePlayGamePlugin: 0.10.12
GoogleMobileAds-native: The latest
kunny commented 1 year ago

Since there were no recent activities for this issue, we are therefore reluctantly going to close this bug for now.

If you are still experiencing the problem, please file a new issue with the same description, what happens and system / network tracing / Charles logs.

All system setups can be slightly different, so it's always better to open new issues and reference the related ones. Thanks for your contribution.