I have android version 7.1.1 in my project
after adding android I build the project using "cordova Build" command
And I got following error
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)
Now magic is in my files www/config.xml and xml/config.xml
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="27"/>
and main/AndroidManifest.xml file I have put
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="27" />
While My gradle file also contain
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
}
But after running the command cordova build
it changes all config I made automatically to previous as follows
www/config.xml and xml/config.xml
<preference name="android-minSdkVersion" value="16" />
<preference name="android-targetSdkVersion" value="27"/>
and main/AndroidManifest.xml file I have put
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="27" />
How Cordova Build command run rechange again to 16 if they already want to 19
I used below phonegap version
<preference name="phonegap-version" value="cli-6.3.0" />
remove the android platform and add it with:
cordova platform add android@7.0.0
This should help you.