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

问题描述

这是一个phonegap 3.5 / cordova 3 android应用程序。在www / config.xml中有:

 < preference name =android-minSdkVersionvalue =19> 
< preference name =android-targetSdkVersionvalue =19>但是,当我构建它时,它创建一个AndroidManifest.xml与:

$ b


$ b

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

结果是SDK版本低于19的人可以从商店安装我的应用程序。它从哪里得到10从我如何可以改变它?由于Viewport的奇怪,我的应用程序的行为是可疑的在4.4以下的操作系统,我已经得到来自4.2.2用户的1星评论。

解决方案

对于旧版本的cordova CLI,我曾经手动修改 AndroidManifest.xml 来更改一些设置(启动模式,minsdk ...)



并且使用 Cordova 3.5。某些 内容开始出错,每次我构建项目。



现在我添加了这些行在 config.xml 和设置自动更新:

 < platform name =android> 
< preference name =AndroidLaunchModevalue =singleTop/>
< preference name =android-minSdkVersionvalue =14/>
< icon src =res / android / xhdpi.png/>
<图标src =res / android / ldpi.pngdensity =ldpi/>
< icon src =res / android / mdpi.pngdensity =mdpi/>
< icon src =res / android / hdpi.pngdensity =hdpi/>
< icon src =res / android / xhdpi.pngdensity =xhdpi/>
< / platform>

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

由于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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 20:17