I want to use chrome custom tabs below api 16. My app suports Min SDK Version upto 10(GingerBread). When I declare the customtabs dependency in build.gradle
it gives the following error :
Error:Execution failed for task ':app:processDebugManifest'. Manifest merger failed : uses-sdk:minSdkVersion 10 cannot be smaller than version 15 declared in library [com.android.support:customtabs:23.0.1] Suggestion: use tools:overrideLibrary="android.support.customtabs" to force usage
How can I implement a mechanism to support devices using SDK below api 16 with default browser and above api 16 with customtabs.
tools:overrideLibrary marker (see here)
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>
As mentioned in the error, you can override the minSdk version from the library by using the tools:overrideLibrary marker.
Be sure to check SDK_INT > ICE_CREAM_SANDWICH_MR1 on your code before making calls to the Library to avoid exceptions at runtime.
When using a system that does not support Custom Tabs, just fire a normal ACTION_VIEW intent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With