Java.Lang.Noclassdeffounderror: Com.Google.Ads.Adview

java.lang.NoClassDefFoundError: com.google.ads.AdView

Just create manually the "libs" folder, and add your libraries there. By default, they doesn't exist

java.lang.NoClassDefFoundError: com.google.android.gms.ads.AdView

Adding Google Play Services support to your project

As per the Google Play Services setup guide, one does not simply "add the jars".
Since GPS comes bundled with resources, you have to import it as a new seperate project, and reference it from your own, exisiting project.

Please follow the setup guide. I've just verified that I can reference AdView successfully from my own project incorporating GPS.

Ensuring your device supports Google Play Services

GPS is an external service - it's an APK managed by the Play Store app and you need to ensure that the user has the latest GPS APK and/or one that complies with what you wanna do. Here is the guide: Ensure Devices Have the Google Play services APK.

If the device does not have GPS installed (not a Google device, special ROM, AOSP ROM, old Android, etc...) you can not use AdView.

Weird error with NoClassDefFoundError in com.google.android.gms.ads.internal.util.aq.a

Try changing your target API to 27, or:

Specify requirement for Apache HTTP Legacy library

If your app is targeting API level 28 (Android 9.0) or above, you must include the following declaration within the element of AndroidManifest.xml.

  <uses-library
android:name="org.apache.http.legacy"
android:required="false" />

Sources:

https://groups.google.com/forum/#!topic/google-admob-ads-sdk/K1HKru7RutY

https://developers.google.com/maps/documentation/android-sdk/config#specify_requirement_for_apache_http_legacy_library

java.lang.NoClassDefFoundError: com.google.android.gms.ads.AdView Error

For me it was quite difficult to use AdMob with Eclipse LUNA and the last SDK and ADT.

What I've found it's that you must order your Java Build Path (Right Click then properties) as folow :

Android Dependecies checked, Android xxx Unchecked, Android Private Librairies Checked

And control that in your libs folder the google-play-services.jar is inside !

Error inflating class com.google.ads.AdView

Have you recently updated your Android Tools to r17 or higher? If so, you need to create a libs/ folder in your project, and physically put the SDK in the project. Or, in the Java Build Path, you must Order and Export the SDK jar.

Otherwise, the jar doesn't get included when your apk gets compiled, and all hell breaks loose when you run AdMob code at runtime.

NOTE: This applies to any library your project references.



Related Topics



Leave a reply



Submit