2013-02-01 113 views
1

我正在嘗試將AdMob集成到我的應用程序中。下面是我收到的錯誤...AdMob與我的應用程序集成

02-01 12:34:03.184: E/Ads(23819): The android:configChanges value of the com.google.ads.AdActivity must include screenLayout. 
02-01 12:34:03.184: E/Ads(23819): The android:configChanges value of the com.google.ads.AdActivity must include uiMode. 
02-01 12:34:03.184: E/Ads(23819): The android:configChanges value of the com.google.ads.AdActivity must include screenSize. 
02-01 12:34:03.184: E/Ads(23819): The android:configChanges value of the com.google.ads.AdActivity must include smallestScreenSize. 
02-01 12:34:03.184: E/Ads(23819): You must have AdActivity declared in AndroidManifest.xml with configChanges. 
02-01 12:34:03.204: I/webview(23819): skipInvalidates 
02-01 12:34:03.214: I/webview(23819): skipInvalidates 
02-01 12:34:03.224: I/webclipboard(23819): clipservice: [email protected] 
02-01 12:34:03.714: V/webviewdatabase(23819): TCP pre connection: creating table in database 
02-01 12:34:04.064: I/webview(23819): skipInvalidates 
02-01 12:34:04.084: I/webview(23819): skipInvalidates 
02-01 12:34:04.084: I/webclipboard(23819): clipservice: [email protected] 
02-01 12:34:04.094: I/webview(23819): skipInvalidates 
02-01 12:34:04.254: I/webview(23819): skipInvalidates 

下面是Android清單

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.xx.xxx" 
    android:versionCode="3" 
    android:versionName="1.1.1" > 

    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" /> 
    <uses-permission android:name="android.permission.INTERNET"/> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 


    <application 
     android:icon="@drawable/icon5" 
     android:label="@string/app_name"> 
     <activity 
      android:label="@string/app_name" 
      android:name=".xxx" > 
      <intent-filter > 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

     <activity android:name="com.google.ads.AdActivity" 
      android:configChanges="keyboard|keyboardHidden|orientation"/> 



     <activity android:name="com.xx.xxx.History"></activity> 
     <activity android:name="com.xx.xxx.CommandsList"></activity> 
     <activity android:name="com.xx.xxx.CommandsHelp"></activity> 
    </application> 

</manifest> 

回答上述部分

<activity android:name="com.google.ads.AdActivity"   android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> 

現在,應用程序的執行沒有任何錯誤,但廣告不會顯示。這是logcat。有人可以讓我知道,問題是什麼?

02-01 12:49:15.904: I/Ads(24565): To get test ads on this device, call adRequest.addTestDevice("E0AE86FC822746EB3E5BAB6E54B48BCB"); 
    02-01 12:49:15.984: I/webview(24565): skipInvalidates 
    02-01 12:49:16.104: I/Ads(24565): adRequestUrlHtml: 
<html><head> 
<script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_getSdkConstants();AFMA_buildAdURL(
{"kw":[],"preqs":0,"session_id":"8235404278524521238","u_sd":1,"seq_num":"1","slotname":" a1510b61966655f","u_w":320,"msid":"com.xx.xxx","js":"afma-sdk-a-v6.2.1","mv":"8016010.com.android.vending","isu":"E0AE86FC822746EB3E5BAB6E54B48BCB","cipa":0,"bas_off":0,"format":"320x50_mb","oar":0,"net":"wi","app_name":"3.android.com.xx.xxx","hl":"en","ad_pos":{"height":0,"visible":0,"y":0,"x":0,"width":0},"gnt":2,"u_h":480,"carrier":"40413","bas_on":0,"ptime":0,"u_audio":1});</script></head><body></body></html> 
    02-01 12:49:17.554: W/webcore(24565): Can't get the viewWidth after the first layout 
    02-01 12:49:17.624: W/Ads(24565): Invalid unknown request error: Cannot determine request type. Is your ad unit id correct? 
    02-01 12:49:17.634: I/Ads(24565): onFailedToReceiveAd(Invalid Ad request.) 

我正在使用scrollview來顯示內容。我想在內容後面的屏幕底部顯示廣告。我在scrollview中使用LinearLayout。

<LinearLayout 
       android:id="@+id/linearLayout9" 
       android:layout_width="match_parent" 
       android:layout_height="45px" 
       android:layout_marginBottom="2px" 
       android:background="#000000" > 

       <TextView 
        android:id="@+id/txtViewAdvertisement" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:text="ADVERTISEMENT" 
        android:textSize="16px" 
        android:layout_gravity="center_horizontal" /> 


       <com.google.ads.AdView android:id="@+id/adView" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         ads:adUnitId=" a1510b619xxxxx" 
         ads:adSize="BANNER" 
         ads:loadAdOnCreate="true"/> 



      </LinearLayout> 

如果您需要更多信息,請讓我知道。

謝謝!

它似乎問題與我正在使用的滾動視圖。我會就此問一個單獨的問題。接受我的第一部分的答案。

回答

2

試試這個

<activity 
      android:name="com.google.ads.AdActivity" 
      android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" /> 
+0

由於剛剛發現同樣的... –

+0

我pleausre ........ :) – Beenal

+0

我有更新了我的問題..你能幫我解決這個問題嗎? –

0

試試這個在您的onCreate:

adView = new AdView(this, AdSize.BANNER, "your key");   

AdRequest request = new AdRequest(); 
request.setTesting(false); 
adView.loadAd(request); 
+0

將檢查你的代碼 –