2012-07-26 86 views
0

的代碼並不顯示任何錯誤:不顯示在模擬器谷歌廣告或設備

main.xml 
<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 android:id="@+id/googleads" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     ads:adUnitId="jkdfj8485idj34" 
     ads:adSize="BANNER" 
     ads:refreshInterval="60" 
     ads:loadAdOnCreate="true"/> 


    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="AD" /> 

</LinearLayout> 

AdmobActivity.java 
AdView ad = (AdView)findViewById(R.id.googleads); 

     ad.setEnabled(true); 
     ad = new AdView(this, AdSize.BANNER, MY_BANNER_UNIT_ID); 
     AdRequest r = new AdRequest(); 
     //r.addTestDevice(AdRequest.TEST_EMULATOR); 
     r.addTestDevice("CD9E4FDFA47A4AA03F9883E77C036EB3"); 
     //r.setTesting(true); 
     ad.loadAd(r); 

我有以下警告:

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?

請幫助我。

回答

相關問題