4

I added Admob into my game and my test ads works on unity editor perfectly and ı don't get any error. However when ı get build for my android device, Ads doesn't show and I get error for this line :

java.lang.ClassNotFoundException: com.google.unity.ads.UnityInterstitialAdCallback
java.lang.Class.classForName(Native Method)
java.lang.Class.forName(Class.java:453)
com.unity3d.player.UnityPlayer.nativeRender(Native Method)
com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
android.os.Handler.dispatchMessage(Handler.java:102)
android.os.Looper.loop(Looper.java:193)
com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.unity.ads.UnityInterstitialAdCallback" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.tts.puzzle.brick.infinity-N5SeCpyddtonur1RZv9mHA==/base.apk"],nativeLibraryDirectories=[/data/app/com.tts.puzzle.brick.infinity-N5SeCpyddtonur1RZv9mHA==/lib/arm64, /data/app/com.tts.puzzle.brick.infinity-N5SeCpyddtonur1RZv9mHA==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
java.lang.ClassLoader.loadClass(ClassLoader.java:379)
java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 8 more
UnityEngine.AndroidJNISafe.CheckException () (at <00000000000000000000000000000000>:0)
UnityEngine.AndroidJNISafe.FindClass (System.String name) (at <00000000000000000000000000000000>:0)
UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) (at <00000000000000000000000000000000>:0)
UnityEngine.AndroidJavaProxy..ctor (System.String javaInterface) (at <00000000000000000000000000000000>:0)
GoogleMobileAds.Android.InterstitialClient..ctor () (at <00000000000000000000000000000000>:0)
GoogleMobileAds.GoogleMobileAdsClientFactory.BuildInterstitialClient () (at <00000000000000000000000000000000>:0)
GoogleMobileAds.Api.InterstitialAd..ctor (System.String adUnitId) (at <00000000000000000000000000000000>:0)
EasyMobile.AdMobClientImpl+Interstitial+Instance.Load () (at <00000000000000000000000000000000>:0)
EasyMobile.AdMobClientImpl+Interstitial.Load (EasyMobile.AdPlacement placement) (at <00000000000000000000000000000000>:0)
EasyMobile.Advertising.LoadAllInterstitialAds (System.Collections.Generic.List`1[T] clients) (at <00000000000000000000000000000000>:0)
EasyMobile.Advertising+<CRAutoLoadAllAds>d__143.MoveNext () (at <00000000000000000000000000000000>:0)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <00000000000000000000000000000000>:0)

1 Answer 1

2

It seems like there is a missing class in your build. Did you resolve all android dependencies? Check-in Assets -> Plugins -> Android folder for googlemobileads-unity.aar file. if this file is not there then do following.

Try to force resolve android dependency in Android Resolver -> Force Resolve. And it'll include all the files in your build.

Sign up to request clarification or add additional context in comments.

8 Comments

Thanks for your response, googlemobileads-unity.aar file is there and already run this force resolve android dependency many time.
what about proguard do you use it?
Yes Used that too..
Used proguard and added that code in it too. -keep class com.google.unity.** { ; } -keep public class com.google.android.gms.ads.**{ public *; } -keep public class com.google.ads.**{ public *; } -keepattributes *Annotation -dontobfuscate
Test ads working fine in unity editor but not working in mobile, I used Lunar Console to get that error in Mobile..
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.