Manifest merger failed : Attribute application@theme
Solution 1
Any idea about how to solve it?
Follow the instructions that were given to you in the error message:
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:5:5-23:19 to override.
In other words, add tools:replace="android:theme"
to your <application>
element.
Or, switch to a different library.
Solution 2
https://github.com/sawankumarbundelkhandi/edge_detection/issues/12#issuecomment-669854455
After a lot of searching, I found this solution working, actually, he did the same as the other told to add
Add these two lines android:theme="@style/AppTheme"
and tools:replace="android:theme"
to the application
tag
Also, add this line xmlns:tools="http://schemas.android.com/tools"
to the root manifest tag too
Here is the full code
<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>
![JoCuTo](https://i.stack.imgur.com/15GS7.png?s=256&g=1)
Comments
-
JoCuTo almost 2 years
I am trying to use this ProgressWheel librery, but I am facing this error after run the proyect.
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.
This is my manifest
<?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>
and my 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?
-
JoCuTo over 7 yearsYes I am going to switch to a different library , I am facing another issue now .
-
Slick Slime over 3 yearsIsn't there any other alternative?
-
CommonsWare over 3 years@SlickSlime: Why is adding
tools:replace="android:theme"
in the manifest a problem? -
CCJ about 3 years@CommonsWare it seems that tools:replace="android:theme" at the application level changes the look of themed UI elements in libraries. Is that expected? If so, that's a problem. Any way to work around that? It seems strange that manifest attributes in libraries don't get their own namespace during manifest merging...
-
CommonsWare about 3 years@CCJ: "Is that expected?" -- yes. I mean, the point of
tools:replace
is to replace something coming from a library. "Any way to work around that?" -- don't usetools:replace
and live with the theme from the library. Or, don't use the library. Or, talk to the library developers and see what recommendations they have. Having anandroid:theme
attribute on an<application>
element in a library might be valid in specific scenarios (e.g., a framework that drives the whole UI), but on the whole it seems like it should be a code smell.