AGP 7.3.1 manifest merger failed - android

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.

Related

Android Studio / Eclipse import error

I am here with a simple problem. I have created a game project in one of the game builders (BuildBox) and now, when I try to import and convert it into an .apk, I get this error:
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 11 cannot be smaller than version 14 declared in library [com.google.android.gms:play-services:10.2.1] C:\Users\Rob.android\build-cache\8f9b56554d0082e5d885287503f760ae18c8f99a\output\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.google.android.gms.play_services" to force usage
The problem is that I am an absolute newbie with Android Studio and I have no idea how could I update the "minSdkVersion" from 11 to 14.
I will appreciate any help!
Thanks a lot!
Edit your build.gradle file of app module in your application, and look for "minSdkVersion" parameter in defaultConfig block.
Just change it to your suitable version.

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?

Error: A problem was found with the configuration of task collectDebugMultiDexComponents

I've update Android Studio to 0.9, build tools to 21.1.0 and gradle to 0.14 because I want to use the new multiDexEnabled true feature. Currently I'm managing the multidex using this approach https://github.com/casidiablo/multidex and everything is working, but the multiDexEnabled feature seems better.
But using gradle 0.14 I've got this error : uses-sdk element cannot have a "tools:node" attribute which I "solved" using the solution posted by #Medo.
But if I use this approach the multiDexEnabled won't work , and I'll get this error:
Error:A problem was found with the configuration of task ':participactclient:collectDebugMultiDexComponents'.
File '/Users/danielecampogiani/Developing/Android/Android Studio/Participact Client/participactclient/build/intermediates/manifests/full/debug/AndroidManifest.xml' specified for property 'manifest' does not exist.
How to solve this?

uses-sdk element cannot have a "tools:node" attribute

I've updated Android Studio last night to 0.9.0, buildToolsVersion to 21.1.0 and gradle to 0.14.0, after that I'm receiving this error
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk element cannot have a "tools:node" attribute
I've spent the last night looking for a solution, I found this:
<uses-sdk tools:node="replace" />
But unfortunately, added one more error!
Error:(10, 5) uses-sdk element cannot have a "tools:node" attribute
Error:(10, 5) Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk element cannot have a "tools:node" attribute
Another solution I've read, to not use support-v4:21, for me I don't use it, since I'm using v13.
Solution:--
Add this line to uses-sdk tag like this:-
<uses-sdk
tools:node="merge" <----This line do the magic
android:minSdkVersion="14"
android:targetSdkVersion="19" />
And add the tools name space in manifest :-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" .....
.../>
OK this is not the answer, but a temporary workaround.
According to the Gradle build tools release notes this problem was fixed in version 0.13.2 (2014/09/26)
However, seems to happen again in 0.14.0 (2014/10/31)
You can disable the manifest merger task in order to build your project for the time being.
Add the following in your build.gradle file
android.applicationVariants.all { variant ->
variant.processResources.manifestFile = file('src/main/AndroidManifest.xml')
variant.processManifest.enabled=false }
See this question for reference.
I ran into this after upgrading to Android Studio 1.0.0 rc4. I had previously been using so that I could make projects with lower min SDK versions than some of the libraries they depended on. Turns out, if you remove tools:replace and let the compiler error out again with the manifest merge conflict, it will provide you with a much better solution:
<uses-sdk tools:overrideLibrary="com.google.android.gms" />
At least, the Google Play Services library was what I was running into. Actually, you can list a whole bunch if you need to. Just comma-separate the package names. You may have to run the compiler a few times until it tells you every library that's causing problems.
My solution
I have removed all of the <uses-sdk tools:node="replace" /> From all of my manifest.xml files
In my base.gradle file(the one for the entire project I Added
ext {
compileSdkVersion = 19
buildToolsVersion = "21"
minSdkVersion = 10
targetSdkVersion = 19
}
In my modules I have this
// all modules
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
// in an application module
defaultConfig {
applicationId "com.something"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode appVersionCode
versionName appVersionName
}
The problem has solved after updating the AS to v0.9.1 and Gradle to 0.14.1.
Thank you guys_
Update
The problem appears again!
Update 2
Here is a workaround to solve this problem:
Open your project with Android Studio 0.8.14 / Gradle build tools 0.13.2
Build your project.
Switch back to Android Studio 0.9.1 / Gradle build tools 0.14.1
gradlew assembleRelease will work now

How to change the Android Studio Project minSDK version?

I had a recurring error that I wasnt sure how to correct. My android studio was returning the an error indicating that my minSdk version was 11 and had to 14 in order to use the NoTitleBar parent reference in styles.xml. My AndroidManifest had the tag <uses-sdk android:minSdkVersion="14"/> but the error would not go away. I re-cleaned the project and tried to build again - same error.
Android Studio version: 0.8.6
OS: Win8.1
In app > build.gradle file try to modify this section
defaultConfig {
minSdkVersion 11
}
Best regards
Although I had the minSdk set in the manifest the project level sdk was overriding this or at least causing a collision. I located this way: File -> Project Structure -> App -> Flavors -> Change the minSdk version to whatever you need (preferably to match whats in the manifest if its declared - otherwise remove it from there). Hope this helps.
As a note I also next ran into this error I have not resolved yet:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1

Categories

Resources