Cordova Build minSdkVersion更改为16到19

时间:2018-09-14 09:20:33

标签: android cordova phonegap-plugins phonegap-build

我的项目中有android 7.1.1版

添加android后,我使用“ cordova Build”命令构建项目

我得到以下错误

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

:app:processDebugManifest FAILED
uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:CordovaLib] C:\Users\trikonuser\TestAgain\WebCall_AS_tsim\webCall\platforms\android\CordovaLib\build\ intermediates\manifests\full\debug\AndroidManifest.xml as the library might be using APIs not available in 16

Suggestion: use a compatible library with a minSdk of at most 16,
        or increase this project's minSdk version to at least 19,
        or use tools:overrideLibrary="org.apache.cordova" to force usage (may lead to runtime failures)

我的文件中现在有魔法了 www / config.xml和xml / config.xml

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

和我放入的main / AndroidManifest.xml文件

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

我的gradle文件也包含

project.ext {

defaultBuildToolsVersion="27.0.1" //String
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=27 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=27 //Integer - We ALWAYS compile with the latest by default
}

但是在运行命令cordova build之后,它会将我自动进行的所有配置更改为以前的

www / config.xml和xml / config.xml

<preference name="android-minSdkVersion" value="16" />
<preference name="android-targetSdkVersion" value="27"/>

和我放入的main / AndroidManifest.xml文件

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="27" />

Cordova Build命令如何运行,如果他们想更改为19,则再次更改为16

我在phonegap版本以下使用

<preference name="phonegap-version" value="cli-6.3.0" />

1 个答案:

答案 0 :(得分:3)

删除android平台并添加:

cordova platform add android@7.0.0

这应该对您有帮助。