Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.ads.AdSize problem #154

Closed
tolgair opened this issue Jan 30, 2016 · 8 comments

Comments

Projects
None yet
5 participants
@tolgair
Copy link

commented Jan 30, 2016

I am always getting this error on logcat i try to integrate admob witgh google play services but it ads are not showed there are no compile errors or any thing else. I updated everything to the latest version but can not get rid of this errror. Please help me i am working on this 3 days and can not show any ads on my game here is the logcat 👍

AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.ads.AdSize
java.lang.ClassNotFoundException: com.google.android.gms.ads.AdSize
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:251)
at java.lang.Class.forName(Class.java:216)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.a(Unknown Source)
at com.unity3d.player.UnityPlayer$b.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: com/google/android/gms/ads/AdSize
... 6 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.AdSize" on path: DexPathList[[zip file "/data/app/com.CpaceStudios.FruitRun-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.CpaceStudios.FruitRun-1, /vendor/
/system/lib/arm]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoade

@ericleich

This comment has been minimized.

Copy link
Member

commented Feb 2, 2016

It looks like you don't have Google Play services library included in the Assets/Plugins/Android folder.

@tolgair

This comment has been minimized.

Copy link
Author

commented Feb 2, 2016

I also have imported google play services. So when I have copy google-play-services_lib to android folder I also get repackaging errors because of duplication I think. I somehow managed to show ads wtih the previous version but with 0.9.30 I tried every solution in internet and I still get the adsize error. Do you have any other solution? What am I doing wrong?

@theoryginal

This comment has been minimized.

Copy link

commented Feb 2, 2016

Hello tolgair,
Could you please check whether you have any aar file under Assets/Plugins/Android folder?
Any duplication directly cause this issue. I used to have this error and I solved it by clearing aar files and keeping google-play-services_lib.

By the way the aar files were imported when I used OneSignal unity file without checking duplication in the past, and later I decided to use older version of OneSignal unity integration.

Please try this and reply, I may help further.

@tolgair

This comment has been minimized.

Copy link
Author

commented Feb 2, 2016

Orhan thank you ver much for your answer I will give it a try but I want to ask a question. I also have Google Play services plugin so is there any need to keep google-play-services_lib folder? Because it automatically deletes it when you try to build?

@theoryginal

This comment has been minimized.

Copy link

commented Feb 2, 2016

If you are using this plugin you will need "google-play-services_lib" folder to plugin work properly (showing ads and so on). Why do you have GPS plugin already in Assets for AdMob or for other services?

@tolgair

This comment has been minimized.

Copy link
Author

commented Feb 2, 2016

I have GPS plugin to use google play services as well. With my working scenario I do not have google-play-services_lib in my android folder and I am using 0.9.27 version of GPS plugin. As I say if you try to build with google-play-services_lib in android folder I get repackaging errors and google-play-services_lib folder is autoamtically deleted. In Admob plugin tutorial they say you should copy it but if you also have GPS plugin you already have this libraries. Am I wrong?

@rampara

This comment has been minimized.

Copy link
Contributor

commented Feb 3, 2016

The newest release of the plugin (v3.0.0) uses the JarResolver plugin to resolve Google Play Services dependencies. This should make integration of multiple Unity plugins that use Google Play Services into your Unity application easier. The entire Google Play Services library project no longer has to be included in your project. Please re-open the issue if you're still having integrating the newest release of this plugin into your Unity application.

  • Ram

@rampara rampara closed this Feb 3, 2016

@radi-cho

This comment has been minimized.

Copy link

commented Feb 5, 2019

I had similar issue and was able to solve it (or at least work around it).
If interested feel free to take a look over my blogpost: https://medium.com/@radicho/how-to-implement-admob-in-unity-a-bit-more-detailed-guide-4baed2821cce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.