安卓:致命异常:AdWorker#1 java.lang.NoSuchMethodError:java.io.IOException异常< INIT> [英] Android: FATAL EXCEPTION: AdWorker #1 java.lang.NoSuchMethodError: java.io.IOException.<init>

查看:227
本文介绍了安卓:致命异常:AdWorker#1 java.lang.NoSuchMethodError:java.io.IOException异常< INIT>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于几个星期我收到来自用户的以下崩溃报告

Since a few weeks i am receiving the following crash reports from users

FATAL EXCEPTION: AdWorker #1
java.lang.NoSuchMethodError: java.io.IOException.<init>
at com.google.android.gms.internal.g.f(Unknown Source)
at com.google.android.gms.internal.g.b(Unknown Source)
at com.google.android.gms.internal.e.a(Unknown Source)
at com.google.android.gms.internal.e.a(Unknown Source)
at com.google.android.gms.internal.bq.ac(Unknown Source)
at com.google.android.gms.internal.cg$1.run(Unknown Source)
at com.google.android.gms.internal.ch$1.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
at java.lang.Thread.run(Thread.java:1096)

除了它是与谷歌的广告/云服务,我根本不知道它从何而来。无法重现它,直到昨天,我开始了一个10英寸的模拟器,并立即看到了这个问题。除去我的codeI部分后identied到下面这段是问题。

Other than it has something to do with google ad/cloud services, i had no clue where it comes from. couldn't reproduce it till yesterday i started up a 10 inch emulator and saw immediately the problem. After removing parts of my code i identied to following piece to be the problem.

public void onActivityCreated(Bundle savedInstanceState) {

    ............

    AdView adView = (AdView)getActivity().findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder()
    .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
    .addTestDevice("CED2A4FD2C192C08557081CC37AA9E54")
    .build();
     adView.loadAd(adRequest);
}

但奇怪的是,它只是发生在涨幅高达10英寸的设备。我测试了各种不同的设备/版本。该问题只发生在10英寸的设备或更大。 Android的版本并不重要。 2.2或4.4它不断崩溃。

The strange thing is that it only happens on 10 inch devices or up. I tested on various different devices/versions. The problem only occurs on 10 inch devices or bigger. Android versions doesnt matter. 2.2 or 4.4 it keeps crashing.

据我了解我没有任何不同的布局文件夹特定设备的尺寸。 在我的广告定义的XML如下:

To my understanding i dont have any different layout folders for specific device sizes. the xml where my ad is defined looks like:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:id="@+id/mainContainer"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/titleContainer"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
    </LinearLayout>

    <com.viewpagerindicator.TabPageIndicator
        android:id="@+id/indicator"
        style="@style/tabsbackground"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />

    <LinearLayout
        android:id="@+id/adViewContainer"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="horizontal" >

        <com.google.android.gms.ads.AdView
            xmlns:ads="http://schemas.android.com/apk/res-auto"
            android:id="@+id/adView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            ads:adUnitId="@string/adid"
            ads:adSize="SMART_BANNER"
            android:gravity="bottom"
            />
    </LinearLayout>

</LinearLayout>

我尝试了不同的横幅大小。犯规帮助。拆除广告请求code解决了这个问题,而且也消除了广告。 任何线索?

I tried out different banner sizes. Doesnt help. Removing the ad request code solves the problem, but also removes the advertising. Anyone a clue?

推荐答案

谷歌移动广告现在通过谷歌提供的播放服务4.0和出现此错误是因为谷歌播放服务不可用。最有可能你会在升级Froyo,那里是一个特殊版本,可用于运行到这一点。

Google Mobile Ads is now offered through Google Play Services 4.0 and this error occurs because the Google Play Services is not available. Most likely you will run into this on Froyo, where there is a special version that can be used.

<一个href="http://developer.android.com/google/play-services/setup.html">http://developer.android.com/google/play-services/setup.html

注:谷歌播放服务4.0.30(2013年11月发布)和新   版本需要的Andr​​oid 2.3或更高版本。如果您的应用程序支持的Andr​​oid   2.2,您可以继续发展与谷歌播放服务SDK,而必须安装谷歌从SDK播放服务升级Froyo   经理。

Note: Google Play services 4.0.30 (released November 2013) and newer versions require Android 2.3 or higher. If your app supports Android 2.2, you can continue development with the Google Play services SDK, but must instead install Google Play services for Froyo from the SDK Manager.

HTTP:// android-developers.blogspot.no/2013/10/google-play-services-40.html

http:// android-developers.blogspot.no/2013/10/google-play-services-40.html

使用现在运行Android 2.3(姜饼)设备的97%以上,或   新平台的版本,我们放弃对Froyo的从这种支持   在谷歌播放服务SDK,以使人们有可能释放   要在未来提供更强大的API。这意味着你会不会   能够在运行Android 2.2(Froyo的)。设备利用这些新的API

With over 97% of devices now running Android 2.3 (Gingerbread) or newer platform versions, we’re dropping support for Froyo from this release of the Google Play services SDK in order to make it possible to offer more powerful APIs in the future. That means you will not be able to utilize these new APIs on devices running Android 2.2 (Froyo).

<一个href="https://developer.android.com/google/play-services/setup.html#ensure">https://developer.android.com/google/play-services/setup.html#ensure

重要:因为这是很难预测的每个设备的状态,   你必须经常检查前一个兼容谷歌播放服务APK   您可以访问谷歌Play业务功能。对于许多应用程序的最佳时机   检查的主要活动的onResume()方法的过程中。

Important: Because it is hard to anticipate the state of each device, you must always check for a compatible Google Play services APK before you access Google Play services features. For many apps, the best time to check is during the onResume() method of the main activity.

Alernative 1是检查谷歌播放服务可以使用AD浏览报之前。

Alernative 1 is to check if Google Play Services is available before using AdView.

int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext();
if(status == ConnectionResult.SUCCESS) {
    //Success! Do what you want
}

Alernative 2是使用GoogleAdMobAdsSdk-6.4.1.jar

Alernative 2 is to use GoogleAdMobAdsSdk-6.4.1.jar

这篇关于安卓:致命异常:AdWorker#1 java.lang.NoSuchMethodError:java.io.IOException异常&LT; INIT&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆