I am using a library which uses its own android:theme, and therefore I receive the following error while building:
Error:(55, 9) Execution failed for task ':contacit:processDebugManifest'.
Manifest merger failed : Attribute application#theme value=(#style/Theme.MainTheme) from AndroidManifest.xml:55:9
is also present at com.github.florent37:materialviewpager:1.0.3.2:11:18 value=(#style/AppTheme)
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:49:5 to override
I've modified my app's AndroidManifest.xml as follows:
<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"
>
...
However, even though I have used the tools:replace attribute, I am still getting the same error from the Manifest merger. Any ideas why?
Remove tools:replace and add tools:node="replace" to application tag. It works for me.
Related
Manifest:
Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed : Attribute permission#<YOUR PACKAGE>.permission.C2D_MESSAGE#name value=(.permission.C2D_MESSAGE) from AndroidManifest.xml
This error generate on Android Studio to build a project.
How to solve this error?
The problem is (as the error message shows) the same permission is available in another manifest (firebase manifest). So you can remove it from your manifest to solve the problem (easy approach). You can also override it in your manifest like below:
<permission android:name="<your-package-name>.permission.C2D_MESSAGE"
android:protectionLevel="signature"
tools:replace="android:name"/>
For using tools you need to add the xmlns:tools="http://schemas.android.com/tools" line in the manifest tag as below:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:allowBackup="false"
android:label="#string/app_name"/>
You can just write below code in your AndroidManifest.xml.
<manifest ...
xmlns:tools="http://schemas.android.com/tools"
...>
And in the application tag ->
<application
...
tools:replace="android:name">
I added PAYTM SDK in my project and now I am facing a problem with merging manifest file since the library has its own manifest file.
So I am getting
> Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application#icon value=(#mipmap/logo) from AndroidManifest.xml:19:9-42
is also present at [com.paytm.pgsdk:pgsdk:1.0.6] AndroidManifest.xml:12:9-45 value=(#drawable/ic_launcher).
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:16:5-178:19 to override.
But after adding tools:replace="android:icon" in my application tag, my app has crashed at runtime by the following exception.
Caused by: java.lang.IllegalStateException: You need to use a
Theme.AppCompat theme (or descendant) with this activity.
Here is my manifest file.
<?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.example.demo">
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
tools:replace="android:icon"
android:icon="#mipmap/login_logo"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppTheme">
.
.
.
</application>
Just remove icon="#mipmap/login_logo" and theme="#style/AppTheme" from your Application Manifest and replace drawable ic_launcher in PayTM SDK with your app logo and that would do it.
Application will merge both manifests and you will get your desired theme and logo will be fetched from PayTM's manifest hence you would have replaced their ic_launcher with yours.
Finally, I have solved that theme issue by removing conflicting AppTheme's style from SDK.
Can someone help me to solve this problem.
Error:Execution failed for task ':app:processDebugManifest'
Manifest merger failed : Attribute application#icon value=(#mipmap/ic_launcher) from AndroidManifest.xml:8:9-43
is also present at [Sample:HomeLockerLib:unspecified] AndroidManifest.xml:15:9-45 value=(#drawable/ic_launcher).
Suggestion: add 'tools:replace="android:icon"' to element at AndroidManifest.xml:6:5-22:19 to override.
Add below line inside application tag of your apps Manifest.xml
tools:replace="android:icon"
for eg :
<application
android:name=".ApplicationSubClass"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo.Light"
tools:replace="android:icon" > //HERE
For more information about this bug refer to this url.
I have recently update play services using dependencies
compile 'com.google.android.gms:play-services:7.5.0'
My app icon launcher is in #mipmap/ic_launcher" but this is showing error in AndroidManifest.xml.
Should i again place this icon in drawable or else ?
Help me to find out the solution.
UPDATE: Here is Messages from Android studio
Error:(17, 9) Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application#icon value=(#mipmap/ic_launcher) from AndroidManifest.xml:17:9
is also present at com.pnikosis:materialish-progress:1.0:13:9 value=(#drawable/ic_launcher)
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:14:5 to override
Error:(17, 9) Attribute application#icon value=(#mipmap/ic_launcher) from AndroidManifest.xml:17:9
D:\3cworkspace\PeakPerformance\app\src\main\AndroidManifest.xml
Add following line to the application tag
tools:replace="android:icon"
Also import xmlns:tools="http://schemas.android.com/tools" to manifest file.
under application tag in Manifest,worked for me.
androidtools:replace='android:icon'
android:name=".ApplicationSubClass"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo.Light"
tools:replace="android:icon" > //HERE
I tried to add my own icon to my app in Android Studio and I encountered a Manifest merger fail. I fount an identical question here but his answer is not working for me. I tried adding tools:replace="android:icon" and tools:replace="android:icon,android:theme" (on 2 separate occasions of course) but no change.
This is the error Android Studio is keep giving me.
Error:(12, 9) Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application#icon value=(#drawable/footynews_logo_new) from AndroidManifest.xml:12:9
is also present at com.arasthel:gnavdrawer-library:1.1.4:4:45 value=(#drawable/ic_launcher)
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:9:5 to override
Error:(12, 9) Attribute application#icon value=(#drawable/footynews_logo_new) from AndroidManifest.xml:12:9
EDIT : I just found out even though I thought the app was using the ic_launcher in my project directory, it is actually using the ic_launcher in one of the libraries I'm using. How do I force the app to use my launcher icon instead?
tools:replace="android:icon,android:theme"
should work. Hope you added
xmlns:tools="http://schemas.android.com/tools"
If this is not working you have another option. Use the old manifest merger. Add this in your build.gradle file
android { useOldManifestMerger true }
You can find more information here.
Add two line in manifest file :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="..."
xmlns:tools="http://schemas.android.com/tools"> <!--Add this line-->
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
tools:replace="icon, label"/> <!--Add this line-->
</manifest>