1
votes

I just created a simple ionic cordova project, added a few plugins. When i run ionic cordova build android

I get the following build errors:

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:processDebugManifest'.

    Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:CordovaLib] C:\Users\Ralph Marvin\Desktop\Marvix\Apps\Ionic\Chapel\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)

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 32s cmd: Command failed with exit code 1 Error output: C:\Users\Ralph Marvin\Desktop\Marvix\Apps\Ionic\Chapel\platforms\android\app\src\main\AndroidManifest.xml:36:5-74 Error: uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:CordovaLib] C:\Users\Ralph Marvin\Desktop\Marvix\Apps\Ionic\Chapel\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)

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:processDebugManifest'.

    Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:CordovaLib] C:\Users\Ralph Marvin\Desktop\Marvix\Apps\Ionic\Chapel\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)

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

I have the ff in my config.xml:

    <preference name="android-minSdkVersion" value="19" />
    <plugin name="cordova-plugin-whitelist" spec="1.3.3" />
    <plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
    <plugin name="cordova-plugin-ionic-webview" spec="^2.0.0" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
    <plugin name="cordova-plugin-app-update" spec="2.0.2" />
    <plugin name="cordova-plugin-background-mode" spec="0.7.2" />
    <plugin name="cordova-plugin-badge" spec="0.8.8" />
    <plugin name="cordova-plugin-browsertab" spec="0.2.0" />
    <plugin name="cordova-plugin-camera" spec="4.0.3" />
    <plugin name="cordova-plugin-crop" spec="0.4.0" />
    <plugin name="cordova-plugin-file" spec="6.0.1" />
    <plugin name="cordova-plugin-filechooser" spec="1.2.0" />
    <plugin name="cordova-plugin-filepath" spec="1.4.2" />
    <plugin name="cordova-plugin-file-transfer" spec="1.7.1" />
    <plugin name="cordova-plugin-headercolor" spec="1.0.0" />
    <plugin name="cordova-plugin-inappbrowser" spec="3.0.0" />
    <plugin name="cordova-plugin-local-notification" spec="0.9.0-beta.2" />
    <plugin name="cordova-plugin-media" spec="5.0.2" />
    <plugin name="cordova-plugin-media-capture" spec="3.0.2" />
    <plugin name="cordova-plugin-network-information" spec="2.0.1" />
    <plugin name="cordova-plugin-music-controls" spec="2.2.0" />
    <plugin name="cordova-plugin-x-socialsharing" spec="5.4.3">
        <variable name="ANDROID_SUPPORT_V4_VERSION" value="24.1.1+" />
    </plugin>
    <plugin name="cordova-sqlite-storage" spec="2.6.0" />
    <plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
    <plugin name="cordova-plugin-device" spec="^2.0.2" />
    <engine name="android" spec="7.1.4" />

I also have this in my build.gradle

project.configurations.all {
    resolutionStrategy.eachDependency { details ->
        if (details.requested.group == 'com.android.support' && !details.requested.name.contains('multidex') ) {
            details.useVersion "25.0.0"
        }
    }
}

Please help me fix this, its been two days now, I've done all the googling i can and still.

2
Not a real answer, just an advice, I think that one of your plugins declares minSdkVersion 16 that is not compatible with the sdk in use. Usually when I got a build error the first thing I do is to determine which plugin cause the issue, to do this You could checkout your project in another drectory, remove everything ( the android platform and the the plugins ), re-add the platform and the the plugin one by one, checking if the build succeed. But before doing so you could just search if you find the "uses-sdk:minSdkVersion" inside one of your plugins.Sergio Rinaudo

2 Answers

1
votes

It seems like incompatible sdk version.

you must update your config.xml from this <preference name="android-minSdkVersion" value="16" /> to <preference name="android-minSdkVersion" value="19" />

then remove your platform & add again

cordova platform remove android cordova platform add android

1
votes

I also was struggling with this problem, and i found @Sergio Rinaudo's comment the last resort. Since then, i removed all plugins (from folders and from config.xml and package.json), removed the platform and added it again, and began to add the plugins. The culprit in my case (as could be yours, as you have the plugin), was:

<plugin name="cordova-plugin-browsertab" spec="0.2.0" />

Then, i found this and could then edit the version under plugins/cordova-plugin-browsertab/src/android/BrowserTab.gradle. After this, i was sure to:

  • Remove the platform:

    cordova platform rm android
    
  • Add it again, using this version:

    cordova platform add [email protected]
    

This is not an optimal solution, but a workaround.