tools:replace does not work - android

I want to use android:allowBackup=false, but some other libraries have android:allowBackup=true.
So I need to add tools:replace="android:allowBackup", and this is also the way the Manifest Merger suggests, BUT it does not work.
After compile and also in the Manifest Merger Tool I get again the same error.
The tools:replace is already set, but the Manifest Merge suggests to add it.
If I click on the suggestion it will add another tools:replace tag.
Here is the Manifest Merger error:

This seems to be caused by a bug in the Gradle plugin: https://code.google.com/p/android/issues/detail?id=193679
If you remove the tools:ignore attribute from the application element, it should work.

Related

AGP 7.3.1 manifest merger failed

After updating to Android Gradle Plugin 7.3.1 Android Studio says that package is deprecated in AndroidManifest.xml and I need to use namespace param in build.gradle.kts. I removed the package attribute in all my android manifests (I'm using additional manifest files for debug and release builds) and have done this:
build.gradle.kts
android {
...
applicationId = "org.sample.appid"
...
namespace = "org.sample.packageid"
...
}
After this I can not build the project because of the error:
D:\Desktop\Sample\app\src\debug\AndroidManifest.xml:4:5
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : Attribute manifest#package value=(org.sample.packageid) from AndroidManifest.xml:4:5-35
is also present at AndroidManifest.xml:2:1-102:12 value=(org.sample.appid).
Attributes of <manifest> elements are not merged.
Debug manifest can not be merged with the main manifest, but why package name is mixed with applicationId while merging? Is there anything that must be additionally configured? Or there's a bug with AGP 7.3.1?
The error message even precisely tells where the problem lies.
... also remove package from src\debug\AndroidManifest.xml.
The problem was really complex - I missed removing the package attribute in one AndroidManifest.xml. Also, Android Studio must be restarted after that with a full cache clear (without this it will not work). After that everything works as expected.

Manifest merger failed how to solve? [duplicate]

This question already has an answer here:
Manifest Merger Error - Different versions of support library
(1 answer)
Closed 4 years ago.
After adding new library app showing error?
I am trying to add
compile 'com.github.badoualy:stepper-indicator:1.0.7'
and after added this my app showing error
Error:Execution failed for task ':sample:processShopifyDebugManifest'.
Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.4.0) from
[com.android.support:design:25.3.1] AndroidManifest.xml:27:9-31 is
also present at [com.android.support:appcompat-v7:26.0.0-beta2]
AndroidManifest.xml:28:13-41 value=(26.0.0-beta2). Suggestion: add
'tools:replace="android:value"' to element at
AndroidManifest.xml:23:9-25:38 to override.
May be this is right way to solve this issue
https://stackoverflow.com/a/45258773/10010192
Probably you are using multiple versions of Android support library. So Please choose one of version and use it for all libraries. Maybe you can try 25.4.0 for all. (You also need to change compileSdkVersion and targetSdkVersion to 25.4.0)
don't use 'compile' in build.gradle.
try to change
compile 'com.github.badoualy:stepper-indicator:1.0.7'
to
implementation 'com.github.badoualy:stepper-indicator:1.0.7'

Importing project from Eclipse to Android Studio

I just imported an Android project(which was written in Eclipse) to Android Studio. At first, I had some problems so I deleted some dependencies and later when I reimported the project to Android Studio
I had to include the dependencies which I earlier deleted. I tried to run the app and I got the following messages.
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute activity#com.google.android.gms.ads.AdActivity#configChanges value=(keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|locale) from AndroidManifest.xml
is also present at [com.google.android.gms:play-services-ads-lite:9.4.0] AndroidManifest.xml value=(keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize).
Suggestion: add 'tools:replace="android:configChanges"' to <activity> element at AndroidManifest.xml to override.
Error:orientation|screenLayout|uiMode|screenSize|smallestScreenSize)
Error:orientation|screenLayout|uiMode|screenSize|smallestScreenSize|locale) from AndroidManifest.xml
What am I doing wrong?

Sweet Alert Dialog ic_launcer is packaged in version 1.3 and causing compiling issues

When including Sweet Alert dialog in the project, I encountered an issue which caused comilation issues, due to a duplicated ic_launcher dialog which was packaged in the library
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application#icon value=(#mipmap/ic_launcher) from AndroidManifest.xml:7:9-43
is also present at [com.pnikosis:materialish-progress:1.0] AndroidManifest.xml:13:9-45 value=(#drawable/ic_launcher).
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:5:5-22:19 to override.
The Solution was pretty simple, the solution is to add these two lines into the AndroidManifest.xml file:
xmlns:tools="http://schemas.android.com/tools" //manifest element
tools:replace="android:icon" //application element

Android theme error when adding a new dependency

I'm following the examples on this sample from github but when i add the dependency I recieve the error
"
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute application#theme value=(#style/AppTheme) from AndroidManifest.xml:20:9-40
is also present at [com.github.boxme:squarecamera:1.0.3] AndroidManifest.xml:11:18-76 value=(#style/squarecamera__CameraFullScreenTheme).
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:16:5-81:19 to override."
I gather it's because im using this "compile 'com.android.support:appcompat-v7:22.2.1'" which is an older version and is conflicting with the theme from the added dependency.
however I want to avoid changing appcompat to a newer version because every activity i have relies on 22.2.1 and the change would be too great.
Are there any ways of working around this error? Or should i just look into another way of creating a square image from camera activity?

Categories

Resources