Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I ignore minSdkVersion of library in Android Studio?

In my project minSdkVersion = 10, in the library it's 11.

I get:

BUILD_FAILED - Manifest merger failed : uses-sdk:minSdkVersion 10 cannot be smaller than version 11 declared in library.

How to ignore minSdkVersion of library?

like image 771
user1528799 Avatar asked Dec 06 '14 20:12

user1528799


People also ask

How do you change minSdkVersion?

To change Android minSdkVersion in Flutter for the project created after the 2.8 update, you have to make changes in the local. properties file and then reference the new variable from the local. properties file inside the build. gradle file.

Why do we specify minSdkVersion attribute for the Android application?

This attribute informs the system that you have tested against the target version and the system should not enable any compatibility behaviors to maintain your app's forward-compatibility with the target version. The application is still able to run on older versions (down to minSdkVersion ).


2 Answers

You need to change your project to library's value 11, because that attribute means that library was designed to be used at devices at least with API 11. It does not support API 10 at all, so you can not use it according requirements and minimal SDK of your project. See more details about < uses-sdk >

or

Find another library which will support API 10

UPDATE:

or

Use power of ManifestMerger. From official site.

Paragraph Markers

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>
like image 176
gio Avatar answered Oct 09 '22 13:10

gio


you have to declare in your manifest file as below

<uses-sdk tools:overrideLibrary="com.example.android" />

and do not forget to safe use of library like :

if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {

//your code here
}
like image 22
behrad Avatar answered Oct 09 '22 13:10

behrad