其他分享
首页 > 其他分享> > Android Gradle Manifest合并失败

Android Gradle Manifest合并失败

作者:互联网

我使用leanback库为Android TV开发.我的应用程序将min API声明为16,但leanback最低API为16.
因此,正如文档所述我在我的清单中声明了这一点:

<?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" />

但是我仍然有错误:

错误:(6,5)任务’: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

在Manifest合并报告中我可以看到:

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

所以看起来它正在添加工具:overrideLibrary但它仍然失败.

谁知道如何解决这个问题?

解决方法:

问题来自Mixpanel库,Mixpanel使用此标记定义其AndroidManifest:

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

所以我最终放弃了Mixpanel,我宁愿放弃他们而不是10%的用户.

标签:android,gradle,android-library,leanback,android-tv
来源: https://codeday.me/bug/20190609/1204213.html