Phonegap为不同版本的android构建
我想为android的特定版本构建我的phonegap项目,例如android 4.4(Kitkat),5.0(Lollipop)和更低版本。Phonegap为不同版本的android构建
phonegap build
在运行构建命令时,它为当前正在使用的sdk的api级别构建。
我应该运行什么命令,或者应该设置什么设置才能获得特定于版本的构建?
在您的phonegap项目文件夹中,导航至platforms/android/
。打开project.properties
进行编辑。
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-19
android.library.reference.1=CordovaLib
更改target = android-16
为Android 4.1版本,target = android-19
为Android 4.4,target = android-21
为Android 5.0。 现在,当你建立你会得到特定版本的Android版本。
[注意:您需要安装相应的api。您可以通过运行android
开放的Android ADK经理,并下载软件包。]
您应该编辑AndroidManifest.xml
<uses-sdk android:minSdkVersion="integer"
android:targetSdkVersion="integer"
android:maxSdkVersion="integer" />
minSdkVersion
是运行应用程序所需的最低API级别。
maxSdkVersion
是应用程序设计运行的最大API级别。
targetSdkVersion
是应用程序所针对的API级别。
接受的答案建议使用project.properties目标,但是这是用于指定用于编译应用程序的SDK,但不应该这样做,您应该始终使用最新安装并更改AndroidManifest.xml
谢谢,这也很好。我以前试过这个,但是我只设置了'android:minSdkVersion' – 2015-04-16 12:27:39
这工作得很好。虽然安装软件包有点费时。 – 2015-04-06 08:46:13