uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library
Asked Answered
S

30

58

I don't understand this error message

  C:\Program Files (x86)\Jenkins\workspace\__temp-mobile-prev\platforms\android\AndroidManifest.xml:67:5 Error:
        uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library C:\Program Files (x86)\Jenkins\workspace\__temp-mobile-prev\platforms\android\build\intermediates\exploded-aar\com.paypal.sdk\paypal-android-sdk\2.14.2\AndroidManifest.xml
        Suggestion: use tools:overrideLibrary="com.paypal.android.sdk.payments" to force usage

Because line 67 of AndroidManifest.xml looks like:

<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="22" />

Where does 15 come from?

I use ionic to build my app. But I don't think that this is the problem.

Singleness answered 18/5, 2016 at 7:36 Comment(3)
minSdkVersion __ targetSdkVersion __ and compileSdkVersion __ in Build.gradle(Module: app)Ragtime
Do you use external libraries?Mangle
@YoannHercouet I just use the ionic framework. I don't know if they use external libraries. Maybe the ionic plugins are external libraries. The error occurs because the paypal plugin expect a minimum sdk version of 16Georgeannageorgeanne
S
32

The problem for me was in cordova-plugin-browsertab.

You need to change line 1 of my_project/plugins/cordova-plugin-browsertab/src/android/BrowserTab.gradle to

def minSdkVersion = 19

Make sure you have the minimum SDK added to your config.xml

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

Then remove and add cordova-android by:

cordova platform remove android
cordova platform add android
Stupefy answered 13/2, 2019 at 11:10 Comment(1)
It's the same place which cause error in my project. But define <preference name="android-minSdkVersion" value="19" /> in config.xml doesn't help. I have modify the line 1 of my_project/plugins/cordova-plugin-browsertab/src/android/BrowserTab.gradle to: def minSdkVersion = 19 and then reinstall android platform.Celanese
C
32

In the code editor of your app,
Press Ctrl+Shift+F
Search for minSDKVersion
Replace with the desired version number

Cassady answered 7/8, 2020 at 2:41 Comment(3)
Works great! Do not replace in build folder.Maurer
Very simple and works pretty well. Thank you.Volnay
Simple and greatCatechol
S
26

Maybe I found the problem.

I don't want to overwride the build.gradle, because cordova create this file dynamically. But I searched why that cdvMinSdkVersion returns a wrong value. And the reason was this barcodescanner-plugin. The plugin gradle file has this line

ext.cdvMinSdkVersion = 15

which overwrite my value from AndroidManifest.xml. After I have remove and add the plugin again it works. But I don't know why? Maybe someone could explain the order of the different gradle scripts.

Singleness answered 19/5, 2016 at 6:22 Comment(6)
You sir, deserve a beer!!Dmso
Make it 3 beers. I can confirm this fix to work. I'm working on Cordova 6.2.0, and it did the trick!Vermeil
And another beer ;) ThxJulianajuliane
I don't exactly understand what you are saying but I did a grep on that line of code and it was within a Mapbox plugin which I removed and then the build was successful .. Crazy stuff but another beer from hereSemiliterate
As Peter said, I had added cordova-plugin-mapbox, it has a mobile-mapbox.gradle file with the cdvMinSdkVersion of 15. Now I wonder, did you ever find a less hacky solution, than editing the files of the plugin yourself? I'm not sure from which direction to approach the problem.. config.xml, mapbox, other configuration option? Rather strangely, my build error was: Suggestion: use tools:overrideLibrary="org.xwalk.core" to force usagewhich mentions xwalk (we also recently added crosswalk plugin) but the fix was mapbox.Deodorize
A BEER FACTORY: the same line was in cordova-plugin-bowsertab thanks.Nanaam
S
11

As of release 2.14.0, the minSdkVersion has been increased to 16. If you prefer to have your app on a lower minSdkVersion and want to leverage the latest SDK, please disable PayPal for versions below API 16, add xmlns:tools="http://schemas.android.com/tools inside the manifest's xml declaration, and add the following snippet to your AndroidManifest.xml:

<uses-sdk android:minSdkVersion="INSERT_YOUR_DESIRED_minSdkVersion_HERE" tools:overrideLibrary="com.paypal.android.sdk.payments"/>
Schonfield answered 2/9, 2016 at 16:2 Comment(0)
P
10

Here are some context to understand the things:

By default, when importing a library with a minSdkVersion value that's higher than the main manifest file, an error occurs and the library cannot be imported. To make the merger tool ignore this conflict and import the library while keeping your app's lower minSdkVersion value, add the overrideLibrary attribute to the tag. The attribute value can be one or more library package names (comma-separated), indicating the libraries that can override the main manifest's minSdkVersion.

For example, if your app's main manifest applies overrideLibrary like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.app"
          xmlns:tools="http://schemas.android.com/tools">
  <uses-sdk android:targetSdkVersion="22" android:minSdkVersion="2"
            tools:overrideLibrary="com.example.lib1, com.example.lib2"/>

Then the following manifest can be merged without an error regarding the <uses-sdk> tag, and the merged manifest keeps minSdkVersion="2" from the app manifest.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.lib1">
   <uses-sdk android:minSdkVersion="4" />
Pacer answered 17/1, 2018 at 10:40 Comment(0)
T
10

The easier way to do this is to:

-Go to Build.gradle(Module:app).

-Change minSDKVersion 15 to minSDKVersion 16.

-Sync your project.

Tyre answered 1/6, 2019 at 8:50 Comment(0)
F
5

In case of Hybrid/Ionic app such issue could get fixed by changing minSdkVersion in config.xml is what I did.

Formality answered 27/3, 2018 at 7:41 Comment(0)
T
5

work like a charm:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.aspireone.myapplication"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-sdk android:targetSdkVersion="28" android:minSdkVersion="14"
            tools:overrideLibrary="com.allyants.draggabletreeview"/>

from this error message:

 <!-- Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library [com.github.jakebonk:DraggableTreeView:1.0.1] C:\Users\ASPIREone\.gradle\caches\transforms-1\files-1.1\DraggableTreeView-1.0.1.aar\45f4095d2e68f3e9a1fbc4b73c7f9c33\AndroidManifest.xml as the library might be using APIs not available in 14
        Suggestion: use a compatible library with a minSdk of at most 14,
            or increase this project's minSdk version to at least 15,
            or use tools:overrideLibrary="com.allyants.draggabletreeview" to force usage (may lead to runtime failures) -->
Tourane answered 24/3, 2019 at 3:26 Comment(0)
T
4

The problem started for me after I added "jitPak" library for viewing PDF, the root cause of the problem turn out to be line 13 in build.gradel (Module Level). Just change the version from 15 to 16, will resolve the issue.

android {       // line 7 of build.gradle (module App)
    compileSdkVersion 28
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.web_app"
        minSdkVersion 15    // change this to 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
Troyes answered 18/10, 2019 at 14:25 Comment(0)
M
2

This solved my problem. Right click on app folder in android studio, select 'open module settings' | or just press F4. Go to Flavors Tab and change Min Sdk Version to the latest. Problem Solved.

Malva answered 4/7, 2018 at 14:12 Comment(0)
Y
2

Increase the minSdkVersion as your requirement, hope it will be solved.

Yvor answered 12/9, 2019 at 6:8 Comment(0)
T
2

I will prove to you that The easier way to do this is to apply these 3 steps following:

1) Go to Build.gradle(Module:app).

2) Change minSDKVersion 15 to minSDKVersion 16. or 17

// 19(for projectfolder/platforms/android/CordovaLib/AndroidManifest.xml)

3) Sync your project.

They answered 18/3, 2020 at 13:24 Comment(0)
G
2

I had the same issue when working on an android application using Flutter:

Flutter Suggestion:

enter image description here

Solution:

enter image description here

Gambell answered 17/11, 2022 at 4:10 Comment(0)
D
1

I use @Naga suggestion, and it's work.
config.xml that I change is not in the root of project, but in platforms/android/app/src/main/res/xml/config.xml

and minSdkVersion in AndroidManifests.xml are not overwritten again

Diakinesis answered 30/7, 2018 at 3:48 Comment(1)
When I generate app using cordova build android it automatically overrides the value.Gearard
S
1

Try this instead. Change minSdkVersion 15 to minSdkVersion 16 in build.gradle(module: app)

Stabilizer answered 23/4, 2019 at 7:2 Comment(0)
O
1

This error message means that the minimal android version of the paypal library is 16, not your own app's version.

If one of the 3rd party libraries you use has the bigger minimum version than your version, you have to increase your minSdkVersion to them.

Ouphe answered 5/7, 2019 at 3:2 Comment(0)
S
1

Go to build.grade and inside the defaultConfig there is minSdkversion and change that to 17 and sync now and it work i mean it at least worked for me

Spit answered 13/7, 2020 at 18:35 Comment(0)
B
1

Downgrade your version 'audioplayers: ^0.17.1' to 'audioplayers: ^0.16.1' in pubspec.yaml and pub get the dependencies of 'audioplayers: ^0.16.1'.

Bluma answered 4/1, 2021 at 6:32 Comment(0)
K
1

I have the same problem. And I solve it changing in C:\Users\"Username"\.gradle\gradle.properties cdvMinSdkVersion to 19

org.gradle.daemon=false
org.gradle.jvmargs=-Xmx2048m
android.useAndroidX=false
android.enableJetifier=false
cdvMinSdkVersion=19

I found out when I Import the project in Android Studio.

Kilometer answered 17/5, 2021 at 23:55 Comment(0)
S
1

Set the minSdkVersion in android/app/build.gradle:

android {
    defaultConfig {
        minSdkVersion 20
    }
}
Sever answered 2/6, 2021 at 4:53 Comment(0)
B
1

I got same problem today when I added firestore dependency in flutter. It was solved by doing mentioned changes in the android/app/build.gradle file

Before

defaultConfig {
    minSdkVersion flutter.minSDKVersion
    targetSdkVersion flutter.targetSdkVersion
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

After

defaultConfig {
    minSdkVersion 21
    targetSdkVersion flutter.targetSdkVersion
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

N.B : doing minSDKVersion 19 won't work change it to minSDKVersion 21.

In case if above changes does not work you can follow steps mentioned in following website. https://ao-system.net/en/note/224

Brent answered 26/1, 2023 at 18:28 Comment(0)
H
0

Please Follow these three steps to solve this error in ionic 3

  1. In projectfolder/platforms/android/CordovaLib/AndroidManifest.xml change

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

    to

    <uses-sdk android:minSdkVersion="19" />
    
  2. in projectfolder/platforms/android/gradle.properties change

    cdvMinSdkVersion=16 or X
    

    to

    cdvMinSdkVersion=19
    
  3. in projectfolder/config.xml change

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

    to

    <preference name="android-minSdkVersion" value="19" />  
    
Huarache answered 3/4, 2019 at 18:41 Comment(0)
H
0

The way I fixed it was to go to platforms\android folder and did a find-in-folder from my VS code editor for minSdkVersion and replaced all minSdkVersion=16 to minSdkVersion=19 regardless of whether cordova generated it dynamically or not. Everything worked fine for me after that.

Hotheaded answered 17/5, 2019 at 14:7 Comment(0)
P
0

go to the folder /platforms/android/android.json change the minsdk version to whatever you want

{
       "xml": "<preference name=\"android-minSdkVersion\" value=\"22\" />",
       "count": 1
},

then go to the plugin that may have messed you up /plugins/{yourplugin}/plugin.xml change the preference value too to the number you want

<preference name="android-minSdkVersion" value="22" />

then check your /platforms/android/build.gradle file and confirm the same value

project.ext {
      defaultBuildToolsVersion="29.0.2" //String
      defaultMinSdkVersion=22 //Integer - Minimum requirement is Android 5.1
      defaultTargetSdkVersion=29 //Integer - We ALWAYS target the latest by default
      defaultCompileSdkVersion=29 //Integer - We ALWAYS compile with the latest by default
}
Paramnesia answered 24/3, 2021 at 13:53 Comment(0)
L
0

I think try to delete implementation 'com.google.firebase:firebase-analytics' in folder android/App/build.gradle. before doing the long steps above

Liquidity answered 15/3, 2022 at 3:6 Comment(1)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review The OP has nowhere mentioned that its build.gralde file has a dependency related to firebase .Gilbertegilbertian
F
0

The error shown means that the package that you are using doesn't support minSdkVersion 15. so try to change in your "Project/android/app/build.gradle" the following : minSdkVersion from 15 to 16 or higher

Fishgig answered 15/3, 2022 at 12:45 Comment(0)
C
0

change this code to -->>>> minSdkVersion flutter.minSdkVersion ->>> minSdkVersion 19

Conflagration answered 5/10, 2022 at 15:56 Comment(0)
L
0

enter image description here

Change the minSdk to 19 or whatever it's asking for in debug console.

Lucindalucine answered 8/3, 2023 at 12:47 Comment(0)
N
0

cordova-plugin-facebook-connect had an outdated <preference name="android-minSdkVersion" value="15" /> in its plugin.xml file. Changing it to the value I could see in the logs (21 in my case) resolved the issue.

Nikethamide answered 24/7, 2023 at 9:58 Comment(0)
G
0

add next line to project_folder\android\local.properties

 flutter.minSdkVersion=21

edit minSdkVersion in project_folder\android\app\build.gradle

    defaultConfig {
      ...
        minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()
Gorgoneion answered 7/9, 2023 at 12:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.