Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6343759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:30:29+00:00 2026-05-24T20:30:29+00:00

I’m just trying to get admob running and tested different working code examples from

  • 0

I’m just trying to get admob running and tested different “working” code examples from here.
None of them works.

In the activity I have:

oncreate()

    AdView ad = (AdView) findViewById(R.id.ad);
    AdRequest r = new AdRequest();
    r.addTestDevice("X3XFX518X7DE1FD879XA5XXAX1AX8BXX"); //no clue why this string
    ad.loadAd(r);

In the view definition I have inserted the following (and yes instead of myPubID there is actually my real PUB ID):

<com.google.ads.AdView 
    android:id="@+id/ad" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    ads:adUnitId="<myPubID>" 
    ads:adSize="BANNER"/>  

All I get is a black screen for 1 second.

Following log (logcat) is printed during execution

08-09 10:45:03.527: INFO/ActivityManager(59): Start proc de.syrtec.android.bogloid for activity de.syrtec.android.bogloid/.StartSeite: pid=4402 uid=10043 gids={3003}
08-09 10:45:04.887: ERROR/Ads(4402): Could not get currentAdManager.
08-09 10:45:05.397: WARN/InputManagerService(59): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@450d4998
08-09 10:45:05.567: INFO/Ads(4402): To get test ads on this device, call adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
08-09 10:45:06.159: INFO/Ads(4402): adRequestUrlHtml: <html><head><script src="http://www.gstatic.com/afma/sdk-core-v40.js"></script><script>AFMA_buildAdURL({"preqs":0,"u_sd":1.5,"slotname":"********;</script></head><body></body></html>
08-09 10:45:07.528: WARN/webcore(4402): Can't get the viewWidth after the first layout
08-09 10:45:07.848: INFO/Ads(4402): Received ad url: <"url": "http://r.admob.com:80/ad_source.php?preqs=0&u_sd=1.5&slotname=*****: "null">
08-09 10:45:08.809: DEBUG/webviewglue(4402): nativeDestroy view: 0x2bbb30
08-09 10:45:08.818: INFO/Ads(4402): onFailedToReceiveAd(Ad request successful, but no ad returned due to lack of ad inventory.)
08-09 10:45:11.168: DEBUG/dalvikvm(3148): GC_EXPLICIT freed 32 objects / 1640 bytes in 131ms
08-09 10:45:16.237: DEBUG/dalvikvm(272): GC_EXPLICIT freed 195 objects / 12168 bytes in 137ms

I use GoogleAdMobAdsSdk-4.1.1.jar and Android 2.2 on Emulator.

In my admob account there is no filter and adsense is activated.

I also tried it by instanciating the AdView and adding it to the rootlayout with:
(referring to http://code.google.com/mobile/ads/docs/android/fundamentals.html)

AdView adView = new AdView(this, AdSize.BANNER, "PUB_ID");
LinearLayout layout = (LinearLayout)findViewById(R.id.mainLayout);
layout.addView(adView);
adView.loadAd(new AdRequest());

and got the same behaviour with the following log:

08-09 10:49:18.367: INFO/ActivityManager(59): Start proc de.syrtec.android.bogloid for activity de.syrtec.android.bogloid/.StartSeite: pid=4543 uid=10043 gids={3003}
08-09 10:49:19.297: ERROR/Ads(4543): Could not get currentAdManager.
08-09 10:49:19.797: WARN/ActivityManager(59): Activity pause timeout for HistoryRecord{44fe4350 de.syrtec.android.bogloid/.StartSeite}
08-09 10:49:20.067: INFO/Ads(4543): To get test ads on this device, call adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
08-09 10:49:20.379: INFO/Ads(4543): adRequestUrlHtml: <html><head><script src="http://www.gstatic.com/afma/sdk-core-v40.js"></script*****;</script></head><body></body></html>
08-09 10:49:20.397: WARN/InputManagerService(59): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@450d20b8
08-09 10:49:22.737: WARN/webcore(4543): Can't get the viewWidth after the first layout
08-09 10:49:22.957: INFO/Ads(4543): Received ad url: <"url": "http://r.admob.com:80/ad_source.php?preqs=0&u_sd=1.5&slotname=***** "null">
08-09 10:49:24.038: DEBUG/dalvikvm(4543): GC_FOR_MALLOC freed 3826 objects / 234984 bytes in 154ms
08-09 10:49:24.058: DEBUG/webviewglue(4543): nativeDestroy view: 0x2c5320
08-09 10:49:24.058: INFO/Ads(4543): onFailedToReceiveAd(Ad request successful, but no ad returned due to lack of ad inventory.)
08-09 10:49:24.078: DEBUG/webviewglue(4543): nativeDestroy view: 0x2b81d0

Has anyone a clue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:30:29+00:00Added an answer on May 24, 2026 at 8:30 pm

    I tried like in the suggested tutorial (blog.kerul.net/2011/05/)

    but I only get a black view for a second and then return to android “desktop”:

    The source looks now like this:

    activity class:

    class StartActivity extends AdActivity{
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        setContentView(R.layout.main);
    
        AdView adview = (AdView)findViewById(R.id.adView1);
        AdRequest re = new AdRequest();
        re.addTestDevice(AdRequest.TEST_EMULATOR);
        re.setTesting(true);
        adview.loadAd(re);
    }
    ...
    }
    

    the view:

    <?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:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    
        <com.google.ads.AdView
            xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
            android:id="@+id/adView1" 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" 
            ads:adSize="BANNER"
            ads:adUnitId="MY_PUB_ID" />
    
    </LinearLayout>
    

    And YES I replaced MY_PUB_ID with my real publisher id

    Is there anything missing?
    What Emulator do you use with which Android runtime?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.