具有特定版本的“cordova add platform android”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24698875/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
'cordova add platform android' with specific version
提问by chucre
I want add android platform on cordova using specific version: android-10. I use 'gulp' with 'gulp-shell' to create cordova env, so it must be repeatable in command line for CI and CD.
我想使用特定版本在cordova上添加android平台:android-10。我使用 'gulp' 和 'gulp-shell' 来创建cordova env,因此它必须在命令行中可重复用于 CI 和 CD。
Today when I run:
今天当我跑步时:
$ cordova platforms add android
It create in platforms/android/AndroidManifest.xml
file :
它在platforms/android/AndroidManifest.xml
文件中创建:
android:minSdkVersion="10" android:targetSdkVersion="19"
I want android:minSdkVersion="14" android:targetSdkVersion="19"
我想要 android:minSdkVersion="14" android:targetSdkVersion="19"
回答by MeV
Try to check here what is the list of Android Platforms => Cordova Android Platforms
尝试在这里查看什么是 Android 平台列表 => Cordova Android 平台
and try to use:
并尝试使用:
cordova platform add [email protected]
replacing x.x.x with the version that you need
用您需要的版本替换 xxx
回答by mix3d
In your cordova project's config.xml, add an android platform section:
在您的cordova 项目的config.xml 中,添加一个android 平台部分:
<platform name="android">
<preference name="android-minSdkVersion" value="14" />
</platform>
This way each time you build, it will get added to the android manifest, instead of getting overwritten each time you rebuild.
这样每次构建时,它都会被添加到 android manifest,而不是每次构建时都被覆盖。
If you want to target a newer platform than 19, then you can use a second preference:
如果您想定位比 19 更新的平台,则可以使用第二个首选项:
<preference name="android-targetSdkVersion" value="22" />
Cheers!
干杯!
回答by bruno777
A trick if you don't known which x.x.x release is available, request only the master version. E.g. :
如果你不知道哪个 xxx 版本可用,一个技巧,只请求主版本。例如:
cordova add platform android@4
, will install the next available 4.x.x release. today 4.1.1.
, 将安装下一个可用的 4.xx 版本。今天 4.1.1。
Enjoy
享受
Bruno
布鲁诺
回答by AtanuCSE
Change the AndroidManifest.xml
maually. Open that file in any editor. Then set your choices.
换AndroidManifest.xml
毛利。在任何编辑器中打开该文件。然后设置您的选择。
android:minSdkVersion="14" android:targetSdkVersion="19"
And build the project
并构建项目
$ cordova build android
Goal
目标