Android Gradle Manifest merger failed

4k views Asked by At

I use the leanback library to develop for Android TV. My app declare the min API to 16 however the leanback as a minimum API of 16. So as the documentation says I declared this in my manifest :

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

    <uses-sdk tools:overrideLibrary="android.support.v17.leanback" />

However I still have the error :

Error:(6, 5) Execution failed for task ':app:processAdhocProdManifest'.

Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 17 declared in library /thepathtotheapp/build/intermediates/exploded-aar/com.android.support/leanback-v17/22.2.0/AndroidManifest.xml Suggestion: use tools:overrideLibrary="android.support.v17.leanback" to force usage

in the Manifest merger report I can see :

MERGED from io.fabric.sdk.android:fabric:1.0.2:7:5
    android:targetSdkVersion
        INJECTED from AndroidManifest.xml:0:0
        INJECTED from AndroidManifest.xml:0:0
    android:minSdkVersion
        INJECTED from AndroidManifest.xml:0:0
        INJECTED from AndroidManifest.xml:0:0
    tools:overrideLibrary
        ADDED from AndroidManifest.xml:21:15
    tools:ignore
        ADDED from com.mixpanel.android:mixpanel-android:4.5.4-RC1:14:9
application
ADDED from AndroidManifest.xml:23:5

So it look like it's adding the tools:overrideLibrary but it still fail.

Anyone knows how to fix this ?

1

There are 1 answers

3
Andros On BEST ANSWER

The issue was coming from Mixpanel library, Mixpanel define its AndroidManifest with this tag :

<uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="21"
        tools:ignore="GradleOverrides" />

So I end up giving up on Mixpanel, I prefer give up on them than 10% of our users.