question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 22 declared in library

See original GitHub issue

Issue Type

  • [x ] Bug Report
  • Feature Request
  • Support Question

Description

I encountered this bug when compiling the ionic project. I have followed the instructions on the Internet to continuously modify the project.properties under “myproject/platforms/android” and the project.properties under “myproject/platforms/android/Coedovalib”.

But this did not take effect. When I cleared android and added android again, the same error still appeared. And, the value I changed was restored.

Information

Execution failed for task ‘:app:processDebugManifest’.

Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 22 declared in library [:CordovaLib]

Command or Code

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

Environment, Platform, Device

Version information

Ionic:

Ionic CLI : 6.11.8 Ionic Framework : @ionic/angular 5.0.4 @angular-devkit/build-angular : 0.803.24 @angular-devkit/schematics : 8.1.3 @angular/cli : 8.1.3 @ionic/angular-toolkit : 2.3.3

Cordova:

Cordova CLI : 10.0.0 Cordova Platforms : android 9.0.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 19 other plugins)

Utility:

cordova-res : 0.15.1 native-run : not installed

System:

Android SDK Tools : 26.1.1 (D:\Program Files\sdk) NodeJS : v12.18.0 (D:\Program Files\nodejs\node.exe) npm : 6.14.4 OS : Windows 10

Checklist

  • I searched for already existing GitHub issues about this
  • I updated all Cordova tooling to their most recent version
  • I included all the necessary information above

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
breautekcommented, Sep 15, 2020

This is occurring because you (or a plugin) is setting the project min sdk to something lower than the cordova framework’s min sdk, which for 9.x is set to 22.

Do you have the android-minSdkVersion preference set in your config.xml? If so I’d suggest to increase it to 22 or remove it to allow it to default to 22.

Do note that increasing the min sdk to 22 will limit your app to Android 5.1 or later.

2reactions
ebhsgitcommented, Oct 23, 2020

For others that with similar needs

I was able to build by adding the following to my project’s config.xml

        <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest">
            <manifest xmlns:tools="http://schemas.android.com/tools" />
        </edit-config>
        <config-file parent="/manifest" target="AndroidManifest.xml">
            <uses-sdk tools:overrideLibrary="org.apache.cordova" />
        </config-file>

As noted by @breautek

    <edit-config file="AndroidManifest.xml" target="/manifest" mode="merge">
        <manifest xmlns:tools="http://schemas.android.com/tools" />
    </edit-config>
    <edit-config file="AndroidManifest.xml" target="/manifest/uses-sdk" mode="merge">
        <uses-sdk tools:overrideLibrary="<packageThatNeedsToBeOverridden>" />
    </edit-config>

Results in error

Unable to graft xml at selector “/manifest/uses-sdk” from “[project path]\platforms\android\app\src\main\AndroidManifest.xml” during config install

Read more comments on GitHub >

github_iconTop Results From Across the Web

Manifest merger failed : uses-sdk:minSdkVersion 19 ...
Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [com.instamojo:android-sdk:3.4.0] ...
Read more >
minSdkVersion 16 cannot be smaller than version 19 ...
Hello guys i have a problem which i cannot run the application, it says "minSdkVersion 16 cannot be smaller than version 19 declared......
Read more >
Manifest merger failed in Unity+Android
Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:android_component:] ...
Read more >
Manifest merger failed : uses-sdk:minSdkVersion 20 ...
Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 22 declared in library [:CordovaLib] ...
Read more >
Cannot export game due to unity ads declaring minsdk ...
Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library :) UnityAds :) C:/Users :( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found