Admob just won't work for my Android app

111 views
Skip to first unread message

quinncape

unread,
Apr 14, 2011, 4:08:04 AM4/14/11
to Google AdMob Ads Developers
I integrated the Google Admob SDK to my app after following
instructions on code.google.com but when ever I test it on an emulator
it doesn't show anything. Not even an ad box let alone the ads. I am
pretty sure I am doing something wrong. And most of the forums have
the steps to integrationfor the old SDK. Can someone please lay down
the steps clearly for Admob integration to Android apps? I will be
really thankful as I have been struggling for so many days to get this
straight.

Italo Andrea Lisi

unread,
Apr 14, 2011, 4:18:00 AM4/14/11
to google-adm...@googlegroups.com
Hi,
you should post your logcat lines if you need help!

quinncape

unread,
Apr 14, 2011, 4:30:51 AM4/14/11
to Google AdMob Ads Developers
Thanks for the prompt reply!

I most certainly would past my logcat if I knew I had even installed
the Admob SDK correctly. I am totally new to this stuff. My app is
working just the same way without any trace of ads or admob box. I
searched the whole place but there wasn't any clear steps mentioned to
exactly integrate the new google admob SDK. Please if you could for
once paste the process. I did exactly as the instructions on
http://code.google.com/mobile/ads/docs/android/fundamentals.html but
without any success. Still if you'd like to see the logcat first I'd
be happy to post it!

quinncape

unread,
Apr 14, 2011, 4:31:36 AM4/14/11
to Google AdMob Ads Developers
*post my logcat

bmartin

unread,
Apr 14, 2011, 11:44:42 AM4/14/11
to Google AdMob Ads Developers
I have almost the same issue going on, in the emulator did you set the
testing to true?

// Initiate a generic request to load it with an ad
AdRequest request = new AdRequest();
request.setTesting(true);

If I run it with the BannerEssentials example that admob provides it
runs fine on the emulator, the problem is when I try to run the exact
same app on the phone (DroidX) no ads appear and in my logcat I see
the following error.

04-13 11:39:33.410: WARN/Ads(5662): java.net.ConnectException:
r.admob.com/127.0.0.1:80 - Connection refused
04-13 11:39:33.410: WARN/Ads(5662): at
org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:
254)
04-13 11:39:33.410: WARN/Ads(5662): at
org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:
533)
04-13 11:39:33.410: WARN/Ads(5662): at
java.net.Socket.connect(Socket.java:1055)

Has anyone been able to get some support from admob?

quinncape

unread,
Apr 14, 2011, 1:28:36 PM4/14/11
to Google AdMob Ads Developers
Could you please tell me the steps you used to integrate the Admob
SDK? Were they the same that are on code.google.com? Its just too
frustrating not getting this to work. It all seems so simple!

bmartin

unread,
Apr 14, 2011, 1:37:19 PM4/14/11
to Google AdMob Ads Developers
Yes, they are the exact same steps. Have you updated your SDK via AVD
Manager? What version are you running?

I used the BannerEssentials example provided on the site.

quinncape

unread,
Apr 14, 2011, 1:55:24 PM4/14/11
to Google AdMob Ads Developers
Yes I did update it. I am running the version 4.0.4. It just beats me
how it wont show up. The following request you mentioned needs to be
inserted in the main Activity java file?
AdRequest request = new AdRequest();
request.setTesting(true);


bmartin

unread,
Apr 14, 2011, 2:02:45 PM4/14/11
to Google AdMob Ads Developers
Here is the sample code.

public class BannerEssentials extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

// Lookup R.layout.main
LinearLayout layout =
(LinearLayout)findViewById(R.id.linearLayout);

// Create the adView
// Please replace MY_BANNER_UNIT_ID with your AdMob Publisher ID
AdView adView = new AdView(this, AdSize.BANNER,
MY_BANNER_UNIT_ID);

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

// Initiate a generic request to load it with an ad
AdRequest request = new AdRequest();
request.setTesting(true);

adView.loadAd(request);

quinncape

unread,
Apr 14, 2011, 4:16:05 PM4/14/11
to Google AdMob Ads Developers
So I ran the BannerEssentials apk and that also doesn't show any
adbox. When we put our Admob id into this code do we define it as a
constant?

You said the banner essentials worked for you. I am guessing I am
using the wrong version of emulator maybe. Android 2.1 is what I
used.

This is really sad how such a simple task would take me hours.

Thanks for all the help till now!

wes

unread,
Apr 14, 2011, 4:38:39 PM4/14/11
to google-adm...@googlegroups.com
Can you post any output from `adb logcat`?

bmartin

unread,
Apr 14, 2011, 5:06:55 PM4/14/11
to Google AdMob Ads Developers
Yes, with quotes. example: new AdView(this, AdSize.BANNER,
"a1234567x");

Also post your logCat, let's see what output you get from admob.

quinncape

unread,
Apr 14, 2011, 7:28:41 PM4/14/11
to Google AdMob Ads Developers
One last question before I put up the logcat ( as my project is
showing error now and won't run for me to get the logcat)

// Lookup R.layout.main
LinearLayout layout =
(LinearLayout)findViewById(R.id.linearLayout);


When I put this in my Java file everything else is fine except
"linearLayout" is not recognized and is giving an error. Can you think
of what may be wrong? It says "it cannot be resolved or is not a
field"


Thank you all for your patience with me. Really appreciate it.

quinncape

unread,
Apr 14, 2011, 11:01:42 PM4/14/11
to Google AdMob Ads Developers
After spending hours, my project was built without any errors and i
was able to run the app on the emulator. But i dont see any ads. Also
my app kinda shrunk as I put the LinearLayout code inside my
AbsoluteLayout in the main.xml

The logcat only shows this related to Ads

04-15 02:48:06.105: INFO/Ads(279): Unable to connect to network.
04-15 02:48:06.145: INFO/Ads(279): onFailedToReceiveAd(A network error
occurred.)

No where else can I see anything related to Admob :(

It also had the following error which I dont think has anything to do
with Admob

04-15 02:47:55.244: ERROR/AndroidRuntime(261): ERROR: thread attach
failed
04-15 02:47:55.324: DEBUG/dalvikvm(261): LinearAlloc 0x0 used 623916
of 5242880 (11%)
04-15 02:47:56.224: DEBUG/dalvikvm(59): GC freed 10296 objects /
526304 bytes in 478ms
04-15 02:47:56.265: WARN/ResourceType(59): Resources don't contain
package for resource number 0x7f0700e5
04-15 02:47:56.265: WARN/ResourceType(59): Resources don't contain
package for resource number 0x7f020031


What on earth is wrong with my app?! Please someone help :( I am not
earning anything yet as my app is free and I thought I'd make some
money with this.
Reply all
Reply to author
Forward
0 new messages