admob: app crashes on android 3.2
Asked Answered
A

3

8

I am integrating admob in my perfectly working android app. I managed to get things to work on my Jelly Bean (4.1.2) phone, but the app crashed on my honeycomb tablet (3.2) with the message

java.lang.NoClassDefFoundError: android.net.http.HttpResponseCache

Not sure if relevant but in my manifest file I have set my minSdkVersion="9"

I can not seem to find related issues on Google. Has anyone seen this before? What could be the cause?

edit: there are no files in the libs folder. Everything is set up using gradle.

My manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="foo.bar.results"
    android:versionCode="6"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="19" />

    <application
        android:icon="@drawable/bar"
        android:label="@string/app_name" >
        <meta-data android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <activity
            android:name=".bar"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
            android:theme="@android:style/Theme.Translucent" />
    </application>

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

</manifest>
Aldaaldan answered 25/9, 2014 at 11:34 Comment(4)
have a use lib Project and admob jar fileXylo
This seems to have started today, for a lot of people...Rosetterosewall
I just notice the same problem for my test app today. Admob is crashing at loadAd. I just added a try and catch NoClassDefFoundError to ignore this problem for 3.2 devices as a temporary solution.Dharma
Yet another problem with admob in such short period. The other one a month or so ago took them weeks to fix. Now this. It's costing us money since ads are not being displayed to 3.2 users/ It's costing google money as well, hopefully they'll fix it soon. Mean while I can only hope the a try catch canColloidal
R
2

This seems to be a bug that started for a number of people on September 25th. Google has promised that an update will be coming within the next week to fix this problem.

Bottom line, this comes down to a mistake in the android documents. HttpResponseCache in the Android SDK says it is available in API 13, but it seems that API 13 doesn't actually support HttpResponseCache, rather that you have to go to API level 14 to get support for it. So someone released a build change for API 13 without checking it properly, relying on the Android SDK documents to be correct.

For the time being, the best thing to do is to do something like this:

try {
    adView.loadAd(builder.build());
} catch (NoClassDefFoundError ex) {}
Rosetterosewall answered 1/10, 2014 at 10:18 Comment(3)
Any idea how they will fix this and when? today I updated my google_services_lib to revision 19. Is this the fix they're fixing it in?Colloidal
Rev 19 seems to be around a while. I don't understand perfectly where the problem is, although I noticed it without anything updating from my end. I suspect it's a server issue of some sort...Rosetterosewall
It seems that the problem has been fixed by itself. Everything is now also working on honeycomb. I don't understand very well since I did not update the play services... Google must have NSA access to my PC ;)Aldaaldan
V
4

This seems to be (yet another) but in the Google Play Services. We have 176 crash reports on Android 3.2 for this issue so it is not your code that is the problem.

Here is the issue reported in the Google AdMob forum: http://goo.gl/hNdiVo

Vile answered 27/9, 2014 at 18:9 Comment(1)
thanks for the message. Since this was my first attempt at admob it seems to be very coincidental that this should happen now. Bad karma? :)Aldaaldan
R
2

This seems to be a bug that started for a number of people on September 25th. Google has promised that an update will be coming within the next week to fix this problem.

Bottom line, this comes down to a mistake in the android documents. HttpResponseCache in the Android SDK says it is available in API 13, but it seems that API 13 doesn't actually support HttpResponseCache, rather that you have to go to API level 14 to get support for it. So someone released a build change for API 13 without checking it properly, relying on the Android SDK documents to be correct.

For the time being, the best thing to do is to do something like this:

try {
    adView.loadAd(builder.build());
} catch (NoClassDefFoundError ex) {}
Rosetterosewall answered 1/10, 2014 at 10:18 Comment(3)
Any idea how they will fix this and when? today I updated my google_services_lib to revision 19. Is this the fix they're fixing it in?Colloidal
Rev 19 seems to be around a while. I don't understand perfectly where the problem is, although I noticed it without anything updating from my end. I suspect it's a server issue of some sort...Rosetterosewall
It seems that the problem has been fixed by itself. Everything is now also working on honeycomb. I don't understand very well since I did not update the play services... Google must have NSA access to my PC ;)Aldaaldan
A
-2

Just update your google-play-services from Android SDK Manager . After that restart your IDE , and clean project . It works.

Ambrose answered 25/9, 2014 at 12:32 Comment(2)
Hi, thank you for your answer. I think I am running the latest version, there is no mention of an update in the sdk manager.Aldaaldan
addendum: currently installed version of play services is Rev. 19Aldaaldan

© 2022 - 2024 — McMap. All rights reserved.