2017-01-22 62 views
3

我在我的Xamarin.Forms項目中執行AdMob時遇到問題。Xamarin.Forms AdMob「缺少AdActivity」

所以,當我運行Android應用程序,這是在輸出中顯示:

01-22 16:53:17.351 W/Ads (3529): Missing AdActivity with android:configChanges in AndroidManifest.xml. 
You must have the following declaration within the <application> element: 
<activity android:name="com.google.android.gms.ads.AdActivity" 
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" /> 

但我Manifest,它出現了這一行..:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto"> 
    <uses-sdk android:minSdkVersion="15" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
    <uses-permission android:name="android.permission.INTERNET" /> 
    <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" /> 

而且當我打開包含廣告的頁面時,顯示如下:

enter image description here

這裏有什麼問題?

回答

4

<activity>標籤應該是<application>標籤內

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