清单合并工具:替换失败

Oha*_*had 5 android android-manifest android-gradle-plugin

我正在使用一个使用自己的 android:theme 的库,因此我在构建时收到以下错误:错误:(55, 9) 任务 ':contacit:processDebugManifest' 执行失败。

清单合并失败:来自 AndroidManifest.xml:55:9 的 Attribute application@theme value=(@style/Theme.MainTheme) 也出现在 com.github.florent37:materialviewpager:1.0.3.2:11:18 value=(@style /AppTheme) 建议:将 'tools:replace="android:theme"' 添加到 AndroidManifest.xml:49:5 的元素以覆盖

我修改了我的应用程序的 AndroidManifest.xml 如下:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.main"
    android:versionCode="19"
    android:versionName="2.5" >
...
    <application
        android:name="com.example.application.MainApplication"
        tools:replace="android:theme"
        android:allowBackup="true"
        android:icon="@drawable/logo_icon"
        android:label="@string/app_name"
        android:theme="@style/Theme.MainTheme"
        >
...
Run Code Online (Sandbox Code Playgroud)

然而,即使我使用了该tools:replace属性,我仍然从 Manifest 合并中得到同样的错误。任何想法为什么?

小智 4

删除tools:replace并添加tools:node="replace"到应用程序标签。这个对我有用。