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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…