三星s2中的Android admob案例错误

时间:2013-02-27 13:20:52

标签: android admob

错误是:

02-27 18:41:58.658: E/Ads(30699): An error occurred while destroying an AdWebView:
02-27 18:41:58.658: E/Ads(30699): java.lang.NullPointerException
02-27 18:41:58.658: E/Ads(30699):   at android.webkit.WebView.setWebViewClient(WebView.java:5168)
02-27 18:41:58.658: E/Ads(30699):   at com.google.ads.internal.AdWebView.destroy(SourceFile:252)
02-27 18:41:58.658: E/Ads(30699):   at com.google.ads.internal.c$e.run(SourceFile:191)
02-27 18:41:58.658: E/Ads(30699):   at android.os.Handler.handleCallback(Handler.java:605)
02-27 18:41:58.658: E/Ads(30699):   at android.os.Handler.dispatchMessage(Handler.java:92)
02-27 18:41:58.658: E/Ads(30699):   at android.os.Looper.loop(Looper.java:137)
02-27 18:41:58.658: E/Ads(30699):   at android.app.ActivityThread.main(ActivityThread.java:4511)
02-27 18:41:58.658: E/Ads(30699):   at java.lang.reflect.Method.invokeNative(Native Method)
02-27 18:41:58.658: E/Ads(30699):   at java.lang.reflect.Method.invoke(Method.java:511)
02-27 18:41:58.658: E/Ads(30699):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
02-27 18:41:58.658: E/Ads(30699):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
02-27 18:41:58.658: E/Ads(30699):   at dalvik.system.NativeStart.main(Native Method)
02-27 18:41:58.683: I/Ads(30699): onReceiveAd()

我使用下面的代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <com.google.ads.AdView
        android:id="@+id/ad"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="........."
        ads:loadAdOnCreate="true" />
</LinearLayout>

2 个答案:

答案 0 :(得分:2)

使用以下链接获取解决方案:

https://developers.google.com/mobile-ads-sdk/download

下载最新的jar文件使用6.3.0 jar解决问题

答案 1 :(得分:0)

An error occurred while destroying an AdWebView:
at android.webkit.WebView.setWebViewClient(WebView.java:5168)

这只是在设置WebViewClient时记录崩溃的AdMob SDK。这不是你的错。 你无能为力。使用最新版本的SDK。