清单合并失败:属性 application@theme

Manifest merger failed : Attribute application@theme

我正在尝试使用 this ProgressWheel librery,但是在 运行 项目之后我遇到了这个错误。

Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : Attribute application@theme value=(@style/AppTheme) from AndroidManifest.xml:11:9-40 is also present at [com.github.Todd-Davies:ProgressWheel:1.2] AndroidManifest.xml:13:9-56 value=(@android:style/Theme.NoTitleBar). Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:5:5-23:19 to override.

这是我的清单

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

    <application
        android:name=".di.App"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".ui.activities.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <meta-data
            android:name="io.fabric.ApiKey"
            android:value="xxxxxxxxxxxxxxx"
            />
    </application>
    <uses-permission android:name="android.permission.INTERNET" />
</manifest>

和我的style.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

</resources>

知道如何解决吗?

Any idea about how to solve it?

按照错误消息中给您的说明进行操作:

Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:5:5-23:19 to override.

换句话说,将 tools:replace="android:theme" 添加到 <application> 元素。

或者,切换到不同的库。

https://github.com/sawankumarbundelkhandi/edge_detection/issues/12#issuecomment-669854455

经过大量搜索,我发现这个解决方案有效,实际上,他和另一个告诉添加的一样

将这两行 android:theme="@style/AppTheme"tools:replace="android:theme" 添加到 application 标签

此外,将这一行 xmlns:tools="http://schemas.android.com/tools" 也添加到根清单标签中

这是完整的代码


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.doitcare.app"
    xmlns:tools="http://schemas.android.com/tools">
    <application
        tools:replace="android:theme"
        android:theme="@style/AppTheme"
        ...>
        <activity
            ...
        </activity>
    </application>
</manifest>