如何在 phonegap 中指定最小 SDK?它忽略了 config.xml 中的 android-minsdkversion [英] How can I specify the minimum SDK in phonegap? It is ignoring android-minsdkversion in config.xml

查看:32
本文介绍了如何在 phonegap 中指定最小 SDK?它忽略了 config.xml 中的 android-minsdkversion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个 phonegap 3.5/cordova 3 安卓应用.在 www/config.xml 我有:

<preference name="android-targetSdkVersion" value="19">

但是,当我构建它时,它会创建一个 AndroidManifest.xml:

结果是 SDK 版本低于 19 的人可以从商店安装我的应用程序.它从哪里得到那 10 个,我该如何更改它?由于 Viewport 的奇怪之处,我的应用在低于 4.4 的操作系统上的行为令人怀疑,而且我已经获得了 4.2.2 用户的 1 星评价.

解决方案

使用旧版本的cordova CLI,我曾经手动修改AndroidManifest.xml 以更改一些设置(启动模式、minsdk.xml)...) 就像你在回答中所做的那样.

使用 Cordova 3.5.something 事情开始出错,每次我构建项目时都会丢失一些更改.

现在我在 config.xml 中添加了这些行,并且设置会自动更新:

<preference name="AndroidLaunchMode" value="singleTop"/><preference name="android-minSdkVersion" value="14"/><icon src="res/android/xhdpi.png"/><icon src="res/android/ldpi.png" 密度="ldpi"/><icon src="res/android/mdpi.png" density="mdpi"/><icon src="res/android/hdpi.png" density="hdpi"/><icon src="res/android/xhdpi.png" density="xhdpi"/></平台>

优点是我现在可以删除android平台并重新创建它而不会丢失任何设置.

由于 Phonegap 正在更新为与cordova 内联,config.xml 中的首选项应该适用于新版本,也许您会看到更新的手册丢失了,就像发生在我身上一样..

This is a phonegap 3.5 / cordova 3 android app. In www/config.xml I have:

<preference name="android-minSdkVersion" value="19">
<preference name="android-targetSdkVersion" value="19">

However, when I build it, it creates an AndroidManifest.xml with:

<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />

The result is that people with SDK versions below 19 can install my app from the store. Where is it getting that 10 from and how can I change it? Due to weirdness with Viewport, my app's behavior is suspect on OSes below 4.4 and I am already getting 1-star reviews from 4.2.2 users.

解决方案

With older version of cordova CLI, I used to modify manually AndroidManifest.xml to change a few settings (launch mode, minsdk...) like you do in your answer.

And with Cordova 3.5.something things started to go wrong, and some changes were lost each time I built the project.

Now I added those lines in config.xml and the settings are updated automatically :

<platform name="android">
    <preference name="AndroidLaunchMode" value="singleTop"/>
    <preference name="android-minSdkVersion" value="14" />
    <icon src="res/android/xhdpi.png" />
    <icon src="res/android/ldpi.png" density="ldpi" />
    <icon src="res/android/mdpi.png" density="mdpi" />
    <icon src="res/android/hdpi.png" density="hdpi" />
    <icon src="res/android/xhdpi.png" density="xhdpi" />
</platform>

The advantage is that I can now delete the android platform and recreate it without loosing any setting.

As Phonegap is being updated to be inline with cordova, preferences in config.xml should work with the new version, and maybe you will see your manual updated be lost like it happened to me...

这篇关于如何在 phonegap 中指定最小 SDK?它忽略了 config.xml 中的 android-minsdkversion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆