Xamarin.Forms AdMob"缺少AdActivity"

时间:2017-01-22 17:22:03

标签: c# android xamarin.android xamarin.forms admob

我在Xamarin.Forms项目中实现AdMob时遇到问题。

因此,当我运行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

这里有什么问题?

1 个答案:

答案 0 :(得分:4)

<activity>标记应位于<application>标记

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