java.lang.NoClassDefFoundError的:com.google.android.gms.ads.AdView [英] java.lang.NoClassDefFoundError: com.google.android.gms.ads.AdView
问题描述
我写一个code在我的Android应用程序显示Admob的横幅。我已经为实现这一目标做了以下一些调整:
I am writing a code to display Admob Banner in my Android Application. i have done the following few adjustments in order to achieve this:
- 在配置谷歌播放服务库以下几点: https://developers.google.com/移动广告的SDK /文档/
-
添加
- configured google play services library following: https://developers.google.com/mobile-ads-sdk/docs/
Added
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
和
<meta-data
android:name="com.google.android.gms.version"
android:value="4323000" />
code。在我的清单文件,并且还增加了以下权限:
code in my manifest file, and also added following permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
- 沿袭: https://developers.google.com /移动广告的SDK /文档/ AdMob的/基本面#玩链接来开发我的应用程序中的一面旗帜。
- Followed the: https://developers.google.com/mobile-ads-sdk/docs/admob/fundamentals#play link to develop a banner in my application.
当我尝试运行它抛出以下异常的应用程序时出现的问题:
the problem occurs when i try to run the application it throws the following exception:
05-07 14:51:17.617: E/AndroidRuntime(7877): FATAL EXCEPTION: main
05-07 14:51:17.617: E/AndroidRuntime(7877): java.lang.NoClassDefFoundError: com.google.android.gms.ads.AdView
05-07 14:51:17.617: E/AndroidRuntime(7877): at com.atc.hums.HumsActivity.onCreate(HumsActivity.java:458)
05-07 14:51:17.617: E/AndroidRuntime(7877): at android.app.Activity.performCreate(Activity.java:5165)
05-07 14:51:17.617: E/AndroidRuntime(7877): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1103)
05-07 14:51:17.617: E/AndroidRuntime(7877): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2419)
05-07 14:51:17.617: E/AndroidRuntime(7877): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2520)
05-07 14:51:17.617: E/AndroidRuntime(7877): at android.app.ActivityThread.access$600(ActivityThread.java:162)
05-07 14:51:17.617: E/AndroidRuntime(7877): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1366)
05-07 14:51:17.617: E/AndroidRuntime(7877): at android.os.Handler.dispatchMessage(Handler.java:99)
05-07 14:51:17.617: E/AndroidRuntime(7877): at android.os.Looper.loop(Looper.java:158)
05-07 14:51:17.617: E/AndroidRuntime(7877): at android.app.ActivityThread.main(ActivityThread.java:5751)
05-07 14:51:17.617: E/AndroidRuntime(7877): at java.lang.reflect.Method.invokeNative(Native Method)
05-07 14:51:17.617: E/AndroidRuntime(7877): at java.lang.reflect.Method.invoke(Method.java:511)
05-07 14:51:17.617: E/AndroidRuntime(7877): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1083)
05-07 14:51:17.617: E/AndroidRuntime(7877): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:850)
05-07 14:51:17.617: E/AndroidRuntime(7877): at dalvik.system.NativeStart.main(Native Method)
推荐答案
由于按照谷歌播放服务安装指南,一个不只需添加罐子。 由于GPS捆绑了资源,你必须导入它作为一个新的单独项目,并从自己的引用它,已有的项目。
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.
请按照安装向导。我只是验证我可以引用 AD浏览报
从我自己的项目纳入GPS成功。
Please follow the setup guide. I've just verified that I can reference AdView
successfully from my own project incorporating GPS.
GPS是一个外部服务 - 这是由Play商店应用管理的APK,你需要确保用户拥有一个符合你想做的事了最新的GPS APK和/或一个。下面是指南:确保设备具有谷歌播放服务APK 。
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.
如果设备没有安装GPS(不是谷歌的设备,特殊的ROM,AOSP ROM,旧的Android,等...),你不能使用AD浏览报。
If the device does not have GPS installed (not a Google device, special ROM, AOSP ROM, old Android, etc...) you can not use AdView.
这篇关于java.lang.NoClassDefFoundError的:com.google.android.gms.ads.AdView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!