Eclipse 中针对 android:configChanges 的 Admob 错误

2022-01-25 00:00:00 android eclipse admob

Eclipse 在我的 AndroidManifest.xml 中的 android:configChanges 行出现错误:

Eclipse is giving me an error on the android:configChanges line in my AndroidManifest.xml:

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

错误是:

error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize').

如果我只留下 keyboard|keyboardHidden|orientation 没有错误,但编译器会在我尝试构建时询问剩余的 4 个.

If I leave only keyboard|keyboardHidden|orientation there's no error, but compiler asks for the 4 remaining ones when I try and build.

我正在使用 GoogleAdMobAdsSDK-4.3.1.

有什么想法吗?

我通过将我的 project.properties(SDK 低于 14 的 default.properties)文件更改为:

I got it working by changing my project.properties (default.properties on SDK's lower then 14) file to:

# Project target.
target=android-14

在我的 SDK Manager 中安装了 SDK Platform Android 4.0 - Revision 14.

and in my SDK Manager having the SDK Platform Android 4.0 - Revision 14 installed.

它也应该适用于 SDK Platform android 3.2 - 修订版 13,因此如果是这种情况,您只需将 project.properties 目标更改为 android-13.基本上您只需要确保 SDK 版本为 13 或更高版本,并且您已在 SDK 管理器中安装了该 SDK,并且 default/project.properties 中的项目目标指向它.

It should also work for SDK Platform android 3.2 - revision 13, so you just have to change the project.properties target to android-13 if that is the case. Basically you just have to make sure that the SDK revision is 13 or above, and that you have that SDK installed in the SDK manager and the project target in default/project.properties pointing to it.

推荐答案

简单回答:Android 2.1 不支持上述配置更改,请看这里:

Simple answer: the mentioned config changes are not support in Android 2.1, have a look here:

http://developer.android.com/guide/topics/manifest/activity-element.html#config

例如uiMode 需要 API 级别 8.

e.g. uiMode needs API Level 8.

来自官方 AdMob 文档:

From the official AdMob Documentation:

要求

适用于 Android 的 Google AdMob 广告 SDK 需要 Android 1.5 或更高版本.确保您拥有最新的 Android SDK 副本并且您正在针对至少 Android v3.2 进行编译(将 default.properties 中的目标设置为 android-13).

The Google AdMob Ads SDK for Android requires Android 1.5 or later. Make sure you have the latest copy of the Android SDK and that you're compiling against at least Android v3.2 (set target in default.properties to android-13).

看看这里:https://developers.google.com/admob/安卓/快速启动

所以我认为您的工具版本至少没有更新到版本 13.

So I think your tools version is not updated to at least Version 13.

相关文章