Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
435 views
in Technique[技术] by (71.8m points)

android - AdMob 4.3.1 adds not showing up (No AdMob ID yet (just for test), can't get ViewWidth)

First of all, I know there are a lot of questions about this topic. I searched all over the internet, but most of the tutorials are about older versions of AdMob. Also, all have some kind of different solution for the problem. They all do not work for me. I am very very close to getting these test adds into my application. They just don't show up. I get the following errors:

02-21 21:05:46.457: W/webcore(14924): Can't get the viewWidth after the first layout

02-21 21:05:46.586: W/Ads(14924): Invalid unknown request error: Cannot determine request type. Is your ad unit id correct?

02-21 21:05:46.586: D/webviewglue(14924): nativeDestroy view: 0x685300

02-21 21:05:46.586: I/Ads(14924): onFailedToReceiveAd(Invalid Google Ad request.)

I do not have a AdMob publisher ID yet, since this will be my first APP for the market (and I first have to have an APP on the market before I get an ID for the APP). What ID should I use? Currently I have (testing on my Android Phone):

    AdRequest adRequest = new AdRequest();
    adRequest.addTestDevice("9B08CXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    //adRequest.addTestDevice("037c7xxxxxxxxxxx"); (Not right, is from console)
    AdView adView = (AdView) this.findViewById(R.id.adView);
    adView.loadAd(adRequest);

In my XML, I have (because it also warns about viewWidth?). It is packed in a bigger LinearLayout:

<LinearLayout
 android:orientation="vertical"
 android:layout_width="fill_parent"
 android:layout_height="50dip">

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

</LinearLayout>

I hope the question is small enough, but still contains enough information.

Thanks in advance! Kinds regards, Jos.

EDIT: I do have the manifest file changed (add permissions, activity android:name=..., android:configChanges=...). I added the jar to a lib-folder and added it to the libraries.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You don't need to have an app already on the market to get a Publisher ID for a new app. In the Android Package URL field that's on the "Add Site/App" form, just enter "market://details?id=your.package.name". You'll of course want to replace the 'your.package.name' with your app's actual package name.

The viewWidth warnings are fine and you will likely still see them after inserting your Publisher ID.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...