配置中不允许使用字符串类型更改android manifest

时间:2016-06-24 05:18:34

标签: android xamarin xamarin.android android-manifest

我一直在尝试我能找到的所有解决方案,但我仍然面临这个问题

Error APT0000: String types not allowed (at 'configChanges' with value 'density|fontScale|keyboard|keyboardHidden|layoutDirection|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|touchscreen|uiMode'). (APT0000) 

我已尝试切换目标API,但仍无法正常工作,我当前的minSdkVersion为10,而targetSdkVersion为23。

编辑:在Manifest中添加了导致错误的部分

<activity android:alwaysRetainTaskState="true" android:configChanges="density|fontScale|keyboard|keyboardHidden|layoutDirection|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|touchscreen|uiMode" android:icon="@drawable/icon" android:label="Test" android:launchMode="singleTask" android:name="com.Testing.Test.MainActivity" android:screenOrientation="portrait">
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
</activity>

第二次编辑:我使用的是Xamarin.Android,这就是我在主要活动中所做的事情

Activity(
    Label = "Test",
    Name = "com.Testing.Test.MainActivity",
    MainLauncher = true,
    Icon = "@drawable/icon",
    AlwaysRetainTaskState = true,
    LaunchMode = LaunchMode.SingleTask,
    ScreenOrientation = ScreenOrientation.Portrait,
    ConfigurationChanges =ConfigChanges.KeyboardHidden|ConfigChanges.Keyboard|ConfigChanges.LayoutDirection|ConfigChanges.ScreenSize|ConfigChanges.Orientation|ConfigChanges.Density|ConfigChanges.FontScale|ConfigChanges.Locale|ConfigChanges.Mcc|ConfigChanges.Mnc|ConfigChanges.Navigation|ConfigChanges.ScreenLayout|ConfigChanges.SmallestScreenSize|ConfigChanges.Touchscreen|ConfigChanges.UiMode
)]

3rd Edit:我已经意识到Android Manifest是由Xamarin.Android自动生成的。所以我尝试的每个解决方案都是编辑Manifest,它将被Xamarin生成的Manifest所取代。

2 个答案:

答案 0 :(得分:0)

  

错误APT0000:不允许字符串类型(在&#39; configChanges&#39;有值   &#39;密度| fontScale |键盘| keyboardHidden |的layoutDirection |区域| MCC | MNC |导航|取向|屏幕布置|屏幕尺寸|触摸屏| uiMode&#39)。   (APT0000)

您的上方错误来自Manifest.xml

android:configChanges="fontScale|keyboard|keyboardHidden|layoutDirection|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|touchscreen|uiMode"
screenSize中未提供

SDK 10个属性。API level 13

中介绍了这些属性

请参阅:https://developer.android.com/guide/topics/manifest/activity-element.html#config

因此,将您的SDK minSdkVersion 10更改为minSdkVersion 13,错误就不再存在。

答案 1 :(得分:0)

为什么你在清单中设置它,如果它是Xamarin.Android而是在你的活动中使用类似的东西

[Activity(Label = "ScreenoffLogin",  Theme = "@style/Theme.Splash",LaunchMode=Android.Content.PM.LaunchMode.SingleTop, ConfigurationChanges = Android.Content.PM.ConfigChanges.Orientation)]
    public class ScreenoffLogin : MvxActivity
    {