- Home /
Admob plugin error: Java.Lang.ClassNotFoundException: com.google.android.gms.ads.mobileads
Since switching my build method from internal to gradle I can no longer get the admob plugin to work for unity, the following error is received in logcat:
> 02-05 22:45:56.281: E/Unity(23488):
> AndroidJavaException:
> java.lang.ClassNotFoundException:
> com.google.android.gms.ads.MobileAds
> 02-05 22:45:56.281: E/Unity(23488):
> java.lang.ClassNotFoundException:
> com.google.android.gms.ads.MobileAds
> 02-05 22:45:56.281: E/Unity(23488):
> at
> java.lang.Class.classForName(Native
> Method) 02-05 22:45:56.281:
> E/Unity(23488): at
> java.lang.Class.forName(Class.java:453)
> 02-05 22:45:56.281: E/Unity(23488):
> at
> java.lang.Class.forName(Class.java:378)
> 02-05 22:45:56.281: E/Unity(23488):
> at
> com.unity3d.player.UnityPlayer.nativeRender(Native
> Method) 02-05 22:45:56.281:
> E/Unity(23488): at
> com.unity3d.player.UnityPlayer.c(Unknown
> Source:0) 02-05 22:45:56.281:
> E/Unity(23488): at
> com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown
> Source:151) 02-05 22:45:56.281:
> E/Unity(23488): at
> android.os.Handler.dispatchMessage(Handler.java:101)
> 02-05 22:45:56.281: E/Unity(23488):
> at
> android.os.Looper.loop(Looper.java:164)
> 02-05 22:45:56.281: E/Unity(23488):
> at
> com.unity3d.player.UnityPlayer$c.run(Unknown
> Source:20) 02-05 22:45:56.281:
> E/Unity(23488): Caused by:
> java.lang.ClassNotFoundException:
> Didn't find class
> "com.google.android.gms.ads.MobileAds"
> on path: DexPathList[[zip file
> "/data/app/com.jrfapplications.eggscapade-iB1I9-hArZyWPiiLr_s9zA==/base.apk"],nativeLibraryDirectories=[/data/app/com.jrfapplications.eggscapade-iB1I9-hArZyWPiiLr_s9zA==/lib/arm,
> /data/app/com.jrfapplications.eggscapade-iB1I9-hArZyWPiiLr_
Unity Version: 2017.3.0f3
Android SDK Tools Version: 25.2.5
Admob Plugin: https://github.com/googleads/googleads-mobile-unity/releases/tag/v3.11.0
I have done a force resolve to no avail as well. Any help would be appreciated.
Thanks
Answer by jrfapplications · Feb 07, 2018 at 08:07 PM
I resolved this by changing the player settings 'Minify' under publish settings from proguard to none.
I just want to thank you, after two days of bashing my head at this problem, your solution finally worked. Thanks.
This doesnt work as it already is set to none for me.
Hello i cant find $$anonymous$$ify where it is and how to get it.i mean where it is what is proguard in my publish setting i can only find keystore setting please help
Answer by Tortuap · Jan 14, 2019 at 04:58 PM
If you haven't used the Minify option in your build, then it looks like you're not including the required Google Play dependencies in your Unity project. Ensure the required AAR and JAR files are located in the Assets/Plugins/Android directory. You can perform dependency resolution by selecting Assets -> Play Services Resolver -> Android Resolver ->Resolve in the Unity editor.
In my case just Resolve by itself didn't work, but Force Resolve did the trick. Thanks!