Search code examples
androidadmobandroid-2.3-gingerbread

Admob in Android 2.3


I have an Android app that I am trying to display ads in. The ads display fine on my Galaxy Nexus, running Android 4.1.2, but on my Droid 2, running Android 2.3, they don't display.

I've looked all over the place, and I can't figure out what I'm doing wrong

Android Manifest:

<uses-sdk android:minSdkVersion="8"
        android:targetSdkVersion="16"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<application android:label="@string/app_name" android:icon="@drawable/sms_logo_green_w_blue">
    <activity android:name="com.google.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

XML File:

<com.google.ads.AdView
                android:id="@+id/adView"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                ads:adUnitId="@string/mediation_id"
                ads:adSize="BANNER"
                ads:testDevices="TEST_EMULATOR, <my device id>"
                ads:loadAdOnCreate="true"/>

I've tried loading the ad through Java code instead of through XML like this:

com.google.ads.AdView adView = new com.google.ads.AdView(this, AdSize.BANNER, this.getResources().getString(R.string.mediation_id));
    LinearLayout layout = (LinearLayout)findViewById(R.id.mainAdLayout);

// Add the adView to it
layout.addView(adView);

AdRequest adRequest = new AdRequest();
adRequest.addTestDevice("<my device id>");
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);

adView.loadAd(adRequest);

No matter what I do, the ads don't load on 2.3. Any ideas?

this is all I see in the logcat from my app or admob:

I/Ads     ( 3220): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_getSdkConstants();AFMA_buildAdURL({"kw":[],"preqs":0,"session_id":"16659815784493691135","u_sd":1.5,"seq_num":"1","slotname":"5ae6fdb32cdf4c1a","u_w":320,"msid":"com.havens1515.autorespondfree","js":"afma-sdk-a-v6.2.1","mv":"8011016.com.android.vending","isu":"B78F2F5C240A24F31F6EF9D6EBD74706","cipa":1,"bas_off":0,"format":"320x50_mb","oar":0,"net":"wi","app_name":"17.android.com.havens1515.autorespondfree","hl":"en","ad_pos":{"height":0,"visible":0,"y":0,"x":0,"width":0},"gnt":6,"u_h":569,"carrier":"31000","bas_on":0,"ptime":0,"u_audio":1});</script></head><body></body></html>

W/asset   ( 3220): deep redirect failure from 0x0103003e => 0x02060007, defStyleAttr=0x0101006c, defStyleRes=0x01030019, style=0x00000000

D/dalvikvm( 3220): GC_CONCURRENT freed 225K, 49% free 2928K/5639K, external 513K/519K, paused 2ms+7ms

D/dalvikvm( 3220): GC_EXTERNAL_ALLOC freed 2K, 49% free 2925K/5639K, external 513K/519K, paused 55ms

D/ViewConsistency( 3220): AbsListView android.widget.ListView@40516210 enabled= true

D/ViewConsistency( 3220): AbsListView android.widget.ListView@40516210 enabled= true

then

I/Ads     ( 3220): To get test ads on this device, call adRequest.addTestDevice("B78F2F5C240A24F31F6EF9D6EBD74706");

I/Ads     ( 3220): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_getSdkConstants();AFMA_buildAdURL({"preqs":1,"session_id":"16659815784493691135","u_sd":1.5,"seq_num":"2","slotname":"5ae6fdb32cdf4c1a","u_w":320,"msid":"com.havens1515.autorespondfree","js":"afma-sdk-a-v6.2.1","mv":"8011016.com.android.vending","isu":"B78F2F5C240A24F31F6EF9D6EBD74706","cipa":1,"bas_off":0,"format":"320x50_mb","oar":0,"net":"wi","app_name":"17.android.com.havens1515.autorespondfree","hl":"en","ad_pos":{"height":0,"visible":0,"y":0,"x":0,"width":0},"gnt":6,"u_h":569,"carrier":"31000","bas_on":0,"ptime":400,"u_audio":1});</script></head><body></body></html>

and

D/dalvikvm( 3505): Debugger has detached; object registry had 1 entries

W/ActivityThread( 3505): Application com.havens1515.autorespondfree can be debugged on port 8100...

D/szipinf ( 3505): Initializing inflate state

E/dalvikvm( 3505): Could not find class 'android.app.Notification$Builder', referenced from method com.havens1515.autorespondfree.AutoRespond.showNotification

W/dalvikvm( 3505): VFY: unable to resolve new-instance 15 (Landroid/app/Notification$Builder;) in Lcom/havens1515/autorespondfree/AutoRespond;

D/dalvikvm( 3505): VFY: replacing opcode 0x22 at 0x0031

D/dalvikvm( 3505): VFY: dead code 0x0033-00cd in Lcom/havens1515/autorespondfree/AutoRespond;.showNotification (Landroid/content/Context;)V

D/dalvikvm( 3505): GC_EXTERNAL_ALLOC freed 62K, 50% free 2706K/5379K, external 0K/0K, paused 40ms

I/Database( 3505): sqlite returned: error code = 0, msg = Recovered 14 frames from WAL file /data/data/com.havens1515.autorespondfree/databases/webview.db-wal

I/Database( 3505): sqlite returned: error code = 0, msg = Recovered 18 frames from WAL file /data/data/com.havens1515.autorespondfree/databases/webviewCache.db-wal

I/Ads     ( 3505): To get test ads on this device, call adRequest.addTestDevice("B78F2F5C240A24F31F6EF9D6EBD74706");

W/asset   ( 3505): deep redirect failure from 0x0103003e => 0x02060007, defStyleAttr=0x0101006c, defStyleRes=0x01030019, style=0x00000000

D/dalvikvm( 3505): GC_CONCURRENT freed 204K, 49% free 2926K/5639K, external 513K/519K, paused 2ms+4ms

D/dalvikvm( 3505): GC_EXTERNAL_ALLOC freed 24K, 49% free 2902K/5639K, external 513K/519K, paused 51ms

I/Ads     ( 3505): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_getSdkConstants();AFMA_buildAdURL({"kw":[],"preqs":0,"session_id":"212234885725326360","u_sd":1.5,"seq_num":"1","slotname":"5ae6fdb32cdf4c1a","u_w":320,"msid":"com.havens1515.autorespondfree","js":"afma-sdk-a-v6.2.1","mv":"8011016.com.android.vending","isu":"B78F2F5C240A24F31F6EF9D6EBD74706","cipa":1,"bas_off":0,"format":"320x50_mb","oar":0,"net":"wi","app_name":"17.android.com.havens1515.autorespondfree","hl":"en","ad_pos":{"height":0,"visible":0,"y":0,"x":0,"width":0},"gnt":6,"u_h":569,"carrier":"31000","bas_on":0,"ptime":0,"u_audio":1});</script></head><body></body></html>
D/ViewConsistency( 3505): AbsListView android.widget.ListView@40536910 enabled= true

D/ViewConsistency( 3505): AbsListView android.widget.ListView@40536910 enabled= true

I/Ads     ( 3505): To get test ads on this device, call adRequest.addTestDevice("B78F2F5C240A24F31F6EF9D6EBD74706");

I/Ads     ( 3505): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_getSdkConstants();AFMA_buildAdURL({"preqs":1,"session_id":"212234885725326360","u_sd":1.5,"seq_num":"2","slotname":"5ae6fdb32cdf4c1a","u_w":320,"msid":"com.havens1515.autorespondfree","js":"afma-sdk-a-v6.2.1","mv":"8011016.com.android.vending","isu":"B78F2F5C240A24F31F6EF9D6EBD74706","cipa":1,"bas_off":0,"format":"320x50_mb","oar":0,"net":"wi","app_name":"17.android.com.havens1515.autorespondfree","hl":"en","ad_pos":{"height":0,"visible":0,"y":0,"x":0,"width":0},"gnt":6,"u_h":569,"carrier":"31000","bas_on":0,"ptime":268,"u_audio":1});</script></head><body></body></html>

W/webcore ( 3505): Can't get the viewWidth after the first layout

W/webcore ( 3505): Can't get the viewWidth after the first layout

Got the following from logcat when tracking ad behavior:

I/Ads     ( 5877): AdLoader timed out after 60000ms while getting the URL.

D/webviewglue( 5877): nativeDestroy view: 0x1e94e8

I/Ads     ( 5877): onFailedToReceiveAd(A network error occurred.)

D/AutoRespondFree( 5877): onFailedToReceiveAd (A network error occurred.)

Solution

  • I'm an idiot. I had an adblock app installed on my Droid 2 that I had forgotten about (I haven't used the device in quite some time.)

    Sorry for wasting your time! I did vote up your answer though, because it DID help me realize what the issue was.