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>
PearsonArtPhoto
  • 38,970
  • 17
  • 111
  • 142
bolvo
  • 361
  • 3
  • 13
  • have a use lib Project and admob jar file – Naveen Tamrakar Sep 25 '14 at 11:36
  • 3
    This seems to have started today, for a lot of people... – PearsonArtPhoto Sep 25 '14 at 23:28
  • 1
    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. – xiaowoo Sep 28 '14 at 07:50
  • 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 can – 124697 Oct 03 '14 at 15:58

3 Answers3

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

Christer Nordvik
  • 2,518
  • 3
  • 35
  • 52
  • 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? :) – bolvo Sep 28 '14 at 07:13
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) {}
PearsonArtPhoto
  • 38,970
  • 17
  • 111
  • 142
  • 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? – 124697 Oct 03 '14 at 15:53
  • 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... – PearsonArtPhoto Oct 03 '14 at 22:23
  • 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 ;) – bolvo Oct 09 '14 at 12:27
-2

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

Sanjay Kushwaha
  • 70
  • 2
  • 10
  • 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. – bolvo Sep 25 '14 at 13:33
  • 2
    addendum: currently installed version of play services is Rev. 19 – bolvo Sep 25 '14 at 13:39