I newly created an admob account. I ran a google provided example with my publisher Id, I found the following logs in the emulator logcat:
I/Ads ( 564): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_buildAdURL({"preqs":1,"u_sd":1,"slotname":"**********","u_w":320,"msid":"com.hani.android.admobtest","simulator":1,"cap":"m,a","js":"afma-sdk-a-v4.3.1","isu":"B3EEABB8EE11C2BE770B684D95219ECB","cipa":0,"format":"320x50_mb","net":"ed","app_name":"1.android.com.hani.android.admobtest","hl":"en","extras":{"color_link":"0000FF","color_url":"00FF00","color_text":"000000","color_border":"000000","color_bg":"FF8855"},"u_h":480,"testing":1,"u_audio":4});</script></head><body></body></html>
W/webcore ( 564): Can't get the viewWidth after the first layout
I/Ads ( 564): Received ad url: <"url": "http://googleads.g.doubleclick.net:80/mads/gma?preqs=1&u_sd=1&slotname=**********&u_w=320&msid=com.hani.android.admobtest&cap=m%2Ca&js=afma-sdk-a-v4.3.1&isu=B3EEABB8EE11C2BE770B684D95219ECB&cipa=0&format=320x50_mb&net=ed&app_name=1.android.com.hani.android.admobtest&hl=en&u_h=480&u_audio=4&u_so=p&adtest=on&output=html®ion=mobile_app&u_tz=-180&ex=1&client_sdk=1&askip=1&pto=0&color_link=0000FF&color_url=00FF00&color_text=000000&color_border=000000&color_bg=FF8855&jsv=1", "afmaNotifyDt": "null">
D/dalvikvm( 564): GC_CONCURRENT freed 336K, 48% free 3280K/6279K, external 1651K/1996K, paused 6ms+5ms
I/Ads ( 564): Invalid response code: 404
D/webviewglue( 564): nativeDestroy view: 0x303a88
I/Ads ( 564): onFailedToReceiveAd(There was an internal error.)
and no ads are showing. anybody faced that 404 error before ?
here is my manifest xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/com.hani.titanium.test"
package="com.hani.titanium.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".AdmobTestActivity"
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.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
</manifest>
and the code
package com.hani.titanium.test;
import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;
import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
public class AdmobTestActivity extends Activity {
private AdView adView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
adView = new AdView(this, AdSize.BANNER, "**********");
LinearLayout layout = (LinearLayout)findViewById(R.id.linearLayout);
layout.addView(adView);
AdRequest request = new AdRequest();
// request.addTestDevice(AdRequest.TEST_EMULATOR);
request.setTesting(true);
adView.loadAd(request);
}
}
I tried both setTesting(true) and addTestDevice but none of them worked
I also have project target = 13
for those who are familiar with Titanium I tried it there and got the same output which makes me belive it has something to do with admob service itself
The code itself looks fine. Both
setTesting(true)(which is deprecated FYI) andaddTestDevice(AdRequest.TEST_EMULATORwill properly enable test mode on the emulator. Are you still seeing 404 errors? Do you have internet access on your device?