Taimur Ayaz
Taimur Ayaz

Reputation: 312

Android Studio Manifest merger failed minSdkVersion Error

I am trying to add a dependency in my app which has the minimum sdk version newer than my apps so I am getting the following error

Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library Suggestion: use tools:overrideLibrary="com.nononsenseapps.filepicker" to force usage

but I don't know where to add that suggestion so I can build it. This is how my build.gradle(Module: app) looks right now

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.codedspycamera.android"
    minSdkVersion 9
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.nononsenseapps:filepicker:+'
compile 'com.squareup.picasso:picasso:2.4.0'


}

Upvotes: 2

Views: 3337

Answers (3)

PRATHYUSH P
PRATHYUSH P

Reputation: 175

For ionic developers

config.xml - add -

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

bundle.gradle - add

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:27.1.0'
    }
}

Upvotes: 0

Taimur Ayaz
Taimur Ayaz

Reputation: 312

Just to make the answer more clear for everyone this is what you have to do

tools:overrideLibrary marker

A special marker that can only be used with uses-sdk declaration to override importing a library which minimum SDK version is more recent than that application's minimum SDK version. Without such a marker, the manifest merger will fail. The marker will allow users to select which libraries can be imported ignoring the minimum SDK version.

Example, In the main android manifest :

 <uses-sdk android:targetSdkVersion="14" android:minSdkVersion="2"
          tools:overrideLibrary="com.example.lib1, com.example.lib2"/>

will allow the library with the following manifest to be imported without error :

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.lib1">
    <uses-sdk android:minSdkVersion="4" />
</manifest> 

Note that the if multiple libraries are added than they must be separated with a comma ","

Upvotes: 0

Leonidos
Leonidos

Reputation: 10518

com.nononsenseapps.filepicker works only on >=14 version android device. I think it will crash if you force it to work on <14 devices. But anyway if you want to do this, you should force using minSdkVersion params from your main app to override library value. Add suggested line to main app manifest. Read this for more information.

Upvotes: 2

Related Questions