AdMob 4.3.1 adds not showing up (No AdMob ID yet (

2020-02-07 10:34发布

问题:

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.

回答1:

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.



回答2:

Referring to the following errors:

07-26 15:51:24.046: W/webcore(842): Can't get the viewWidth after the first layout  
07-26 15:51:24.871: W/Ads(842): Invalid unknown request error: Cannot determine request type. 

Is your ad unit id correct?