Switch library based on minSdkVersion - android

On my current Android app, the minimum SDK version is 19. I use a library lets call it as "XYZ.jar".
The minimum compatible version of library is also 19. It works perfectly fine.
Now I have a requirement that my app should support Android 4.1.1 which is of sdkversion 16.
When I changed the minimum SDK version in the app to 16 and when I build it, I get the following error.
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [XXX_Android_v2.0:XXXLibrary:unspecified] XXPATHXX\app\build\intermediates\exploded-aar\XXX_Android_v2.0\XXXLibrary\unspecified\AndroidManifest.xml]
Suggestion: use tools:overrideLibrary="com.xxx.xxx.api3" to force usage
I have one more library lets call it as "ABC" which has an miniumum sdk version 14. So what i need to acheive is when the sdkversion is less than 19
use library ABC and when the sdk version is more than 19 use the liberabry XYZ. How do i acheive this while building my project ?

Related

When I try to add firebase push notification in the android studio then it shows an error

When I try to add firebase push notification in the android studio then it shows an error.
Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.google.firebase:firebase-iid:19.0.0] C:\Users\golam\.gradle\caches\transforms-2\files-2.1\856a947c1a9c6ebc4d2fc0c2fb4dbece\firebase-iid-19.0.0\AndroidManifest.xml as the library might be using APIs not available in 15
Suggestion: use a compatible library with a minSdk of at most 15,
or increase this project's minSdk version to at least 16,
or use tools:overrideLibrary="com.google.firebase.iid" to force usage (may lead to runtime failures)
firebase library com.google.firebase:firebase-iid:19.0.0 is supported minimum
uses-sdk:minSdkVersion 16 but your log shows you have 15 so wou need to change the minsdk level from 15 to 16 or use the library which support the uses-sdk:minSdkVersion 15
Just downgrade your firebase version or upgrade your min sdk to 16 instead of 15

Android Studio 3.4 Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 14

after upgrading Android Studio to version 3.4 my project sync reports an error:
ERROR: Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 14 declared in library [androidx.legacy:legacy-support-v4:1.0.0] C:\Users\pecana\.gradle\caches\transforms-2\files-2.1\0b6817155f227f1df719b12aa7dc1519\AndroidManifest.xml as the library might be using APIs not available in 1
Suggestion: use a compatible library with a minSdk of at most 1,
or increase this project's minSdk version to at least 14,
or use tools:overrideLibrary="androidx.legacy.v4" to force usage (may lead to runtime failures)
I can by the way build the APK and run the application correctly (but only without instant run active). I tried to add the
<uses-sdk tools:overrideLibrary="androidx.legacy.v4"/>
to the main AndroidManifest.xml but the error still occurs.
Any idea on how to fix this ?
Thank you
As the error suggested you can also increase your project's minSdk version to 14 or above.
Go to your build.gradle(Module app) file and add the minimum SDK version like this:
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 14 or above here
}
}

Manifest Merger Failed Error: Gradle Version Issue

I am trying to create a Tinder-style swipe left/swipe right feature. But when I added the dependencies into my code I got this manifest error:
Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.mindorks:placeholderview:0.7.1] /Users/cassandracampbell/.gradle/caches/transforms-1/files-1.1/placeholderview-0.7.1.aar/e4aa1d0fe45df90e4bd68b2aac33a24e/AndroidManifest.xml as the library might be using APIs not available in 15
Suggestion: use a compatible library with a minSdk of at most 15,
or increase this project's minSdk version to at least 16,
or use tools:overrideLibrary="com.mindorks.placeholderview" to force usage (may lead to runtime failures)
How can I fix this?
You are using this library com.mindorks:placeholderview:0.7.1 whose minimum sdk is 16. So in order to use this library your minimum sdk should also be 16. Just change the minimum sdk in your gradle to 16 and it will work.
According to error message:
Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.mindorks:placeholderview:0.7.1]
You need to change your minSdkVersion 14 to 16 in your app/build.gradle . I.e.
defaultConfig {
...
minSdkVersion 16
...
}

Does using `tools:overrideLibrary` have any benifits over `minSdkVersion`?

I'm going to use a library in my project and it shows error:
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library [:library:] ... Suggestion: use
tools:overrideLibrary="test.com.library" to force usage
This prompt lets me know that imported liobrary using higher version (15) than my application min sdk version which is 14.
I want to know if I
I want to know if I use tools:overrideLibrary does it let my application to keep its min SDK version and be installed on phones with API14 or it is not the case? Beside I want to know what is the benefit for using tools:overrideLibrary over `minSdkVersion'?

minSDK version in Android Manifest issue

I've got a little problem with my project.
Few months ago everything was ok (project can be compile and run without any problems). Ater that when i try to compile it (without any changes - only android studio updates), below errors show me up:
E:\Android\Android\android studio projects\Sklepik\app\src\main\AndroidManifest.xml
Error:(8, 5) uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library E:\Android\Android\android studio projects\Sklepik\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\10.2.0\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.google.android.gms.play_services" to force usage
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library E:\Android\Android\android studio projects\Sklepik\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\10.2.0\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.google.android.gms.play_services" to force usage
My manifest looks like:
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17"
/>
and gradle
defaultConfig {
applicationId "****"
minSdkVersion 9
targetSdkVersion 17
}
Even when i change in both setcion minSdk to 14 or add overrideLibrary nothing happens.
How to solve it?
You are using play services with version 10.2.0 that works on higher SDK version (min 14). You can either set 14 as min SDK version in your app or choose a lower play services version that is compatible with skd version 9.

Categories

Resources