1

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" />
Sergi Juanola
  • 6,531
  • 8
  • 56
  • 93
Sandeep Gadhiya
  • 57
  • 2
  • 10
  • 1
    I don't know if that makes sense to you, but in [this answer](https://stackoverflow.com/a/34993175/616225) Ferhat mentions it might work removing the android platform and adding it again. Honestly I didn't try and can't confirm, but with cordova removing and adding always makes it a bit cleaner. Make sure to make a backup before you do that! – Sergi Juanola Sep 14 '18 at 09:47
  • Remove then add android platform again, it should work after that – Eric Sep 15 '18 at 14:09
  • For those using cordova-plugin-browsertab then [this may be your answer.](https://stackoverflow.com/questions/37293082/uses-sdkminsdkversion-15-cannot-be-smaller-than-version-16-declared-in-library/54668764#54668764) – Chris Underdown Feb 13 '19 at 11:21

1 Answers1

3

remove the android platform and add it with:

cordova platform add android@7.0.0

This should help you.

Kai Lück
  • 197
  • 7