Builds fail with error AMM0000 on Xamarin Forms Android projects with Xamarin Forms 4.6.0.967 or 4.7.0.968.
It seems to be provoked by certain nuget packages such as Honeywell.BarcodeReader.
The project builds.
Build fails with the following errors:
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2049,3): error AMM0000: C:\App1\App1\App1.Android\obj\Debug\100\AndroidManifest.xml:36:139-164 Error:
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2049,3): error AMM0000: Attribute application@debuggable value=(true) from AndroidManifest.xml:36:139-164
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2049,3): error AMM0000: is also present at AndroidManifest.xml:15:9-35 value=(false).
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2049,3): error AMM0000: Suggestion: add 'tools:replace="android:debuggable"' to element at AndroidManifest.xml:36:3-59:17 to override.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2049,3): error AMM0000: C:\App1\App1\App1.Android\obj\Debug\100\AndroidManifest.xml:36:16-44 Error:
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2049,3): error AMM0000: Attribute application@label value=(App1.Android) from AndroidManifest.xml:36:16-44
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2049,3): error AMM0000: is also present at AndroidManifest.xml:16:9-41 value=(@string/app_name).
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2049,3): error AMM0000: Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:36:3-59:17 to override.
https://github.com/Yves-Be/AMM0000-issue
Downgrading to Xamarin Forms 4.6.0.847 or removing the Honeywell.BarcodeReader package, allows the build to complete again.
I have a similar problem:
i will try to downgrade to 4.6.0.847
Another Workaround, without downgrade, is to add manually the tools schema into AndroidManifest.xml how suggests by errors above. Follow this steps:
1)Start Debug, and show compiler's error: AndroidManifest conflict (error above).
2)Next i open AndroidManifest.xml from Android project obj/debug/AndroidManifest.xml and add to manifest tag tools:replace="android:label" and to application tag xmlns:tools="schemas.android.com/tools"
3)Save AndroidManifest from obj/debug and restart Debug, and app start without errors.
Downgrade not working for me. I think its related to another library installed.
Hi as this is not related with the Xamarin.Forms package per se.. .Seems its the update of the packages for Android from
Xamarin.AndroidX.Browser (>= 1.0.0)
Xamarin.AndroidX.Legacy.Support.V4 (>= 1.0.0)
Xamarin.AndroidX.Lifecycle.LiveData (>= 2.1.0)
Xamarin.Google.Android.Material (>= 1.0.0)
to
Xamarin.AndroidX.Browser (>= 1.0.0.1)
Xamarin.AndroidX.Legacy.Support.V4 (>= 1.0.0.1)
Xamarin.AndroidX.Lifecycle.LiveData (>= 2.1.0.1)
Xamarin.Google.Android.Material (>= 1.0.0.1)
It works with 4.6.0.847 and fails when we move to 4.6.0.967 where we update the packages above
@Redth can you give me some inside tips for this ?
@rmarinho I would suggest asking @moljac for help here.
I'm thinking this commit in Xamarin.AndroidX is to blame: https://github.com/xamarin/AndroidX/commit/148c9fa358feabbfb5ad4692d0d0287afc66d8ec#diff-8bdc7a3d2559863df7d4ae2aadd6dd52
Seems like it's more of an issue with the new manifestmerger.jar as the new AndroidManifestMerger.
I tried adding <AndroidManifestMerger>legacy</AndroidManifestMerger>
to my build properties, but it did not have any effect.
@jonathanpeppers or @dellis1972 I'd guess you are probably the most qualified to know what is going wrong with the manifest merge?
@moljac this ovewrites the value no matter what the user has in their .csproj
file:
https://github.com/xamarin/AndroidX/commit/148c9fa358feabbfb5ad4692d0d0287afc66d8ec#diff-8bdc7a3d2559863df7d4ae2aadd6dd52
Can you change it to:
<PropertyGroup>
<AndroidManifestMerger Condition=" '$(AndroidManifestMerger)' == '' ">manifestmerger.jar</AndroidManifestMerger>
</PropertyGroup>
Should it put a default value only when $(AndroidManifestMerger)
is blank?
@jonathanpeppers Sure. Consider it done.
Thanks 馃榾
@jonathanpeppers, while this would provide a workaround, it still doesn't fix the underlying issue where android:debuggable and android:label seem to have conflicts when manifestmerger.jar is used.
Replacing the following line in the manifest
<application android:label="App1.Android" android:icon="@mipmap/icon"></application>
with
<application android:label="@string/app_name" android:icon="@mipmap/icon" android:debuggable="false"></application>
Fixes the conflicts, but then you have a non debugable app.
I think I've found where the conflicts are coming from though. In the Honeywell nuget package, there is a DataCollectionLib.dll which contains an Android Manifest which contains this:
<application
android:allowBackup="true"
android:debuggable="false"
android:label="@string/app_name" >
</application>
The docs on manifest merger https://developer.android.com/studio/build/manifest-merge might help here.
Adding tools:replace="android:label, android:debuggable"
to the application element of the AndroidManifest.xml in the app might help
It does raise the question as to why the Honeywell Nuget has a Manifest with an Application element...
Thanks, adding that attribute does fix the conflicts.
Not sure why the manifest has an application element either, perhaps it was something that was forgotten by one of their devs.
I'm also seeing some Hello World stuff...
Since the default behavior will some day soon be restored by the AndroidX packages, and the actual default switch to manifestmerger.jar will probably mentioned in future release notes along with its potential impact, I'm going to close this issue.
Edit: The attribute still gave an error when doing a release build, since the debuggable attribute is not included then. Instead I opted for using tools:node="replace" on the Application element
I use tools:node="replace" tools:replace="android:label" and there are still a lot of problems, so I can only get stuck in andorid 9.0 sdk
We resolved our remaining issue by placing MainActivity.base.OnCreate() after Xamarin.Forms.Init and before LoadApplication(), my best guess is Xamarin.Forms.Init must manipulate/migrate the savedInstance bundle to be androidx compatible.
I've installed the
<PackageReference Include="Xamarin.Firebase.Crashlytics">
<Version>117.0.0</Version>
</PackageReference>
Error
Attribute meta-data#com.google.android.gms.version@value value=(4.2.0) from AndroidManifest.xml:23:62-83
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1813,3): error AMM0000: is also present at AndroidManifest.xml:25:13-66 value=(@integer/google_play_services_version).
is also present at AndroidManifest.xml:25:13-66 value=(@integer/google_play_services_version).
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1813,3): error AMM0000: Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:23:5-86 to override.
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:23:5-86 to override.
Manifest. Where error occurs
<uses-library android:name="org.apache.http.legacy" android:required="false" />
<meta-data android:name="com.google.android.gms.version" android:value="4.2.0" />
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="yourAPIKey" />
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
It looks like it is having a conflict com.google.android.gms.version conflicts with com.google.firebase.iid, any resolution to this? Updating the manifest updates the meta data on it also, so I cannot do what the ide suggested to do so.
@jbtamaresgit
Looking at the error message it looks like you have two meta-data
items somewhere for com.google.android.gms.version
(this includes in a Nuget Package that has been imported).
One has an android:value
of 4.2.0
(hardcoded) the other has @integer/google_play_services_version
. This is what is causing that error. you could try updating the one with 4.2.0
to use @integer/google_play_services_version
? Then make sure the value for google_play_services_version
is set to the version you want?
@jbtamaresgit
Looking at the error message it looks like you have two
meta-data
items somewhere forcom.google.android.gms.version
(this includes in a Nuget Package that has been imported).
One has anandroid:value
of4.2.0
(hardcoded) the other has@integer/google_play_services_version
. This is what is causing that error. you could try updating the one with4.2.0
to use@integer/google_play_services_version
? Then make sure the value forgoogle_play_services_version
is set to the version you want?
Hi @dellis1972
I have updated the manifest file to @integer/google_play_services_version
, and also tried @tools:replace="android:value"
. I resulted with a build error of /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.D8.targets(51,5): error MSB6006: "java" exited with code 1.
Isn't this about proguard?
There should be earlier errrors/warnings in the log that show the actual problem, can you share the full log (or more of it)?
Maybe we need to make the message java exited with code 1
actually say r8.jar exited with code 1
, as it would be much more clear...
There should be earlier errrors/warnings in the log that show the actual problem, can you share the full log (or more of it)?
Maybe we need to make the message
java exited with code 1
actually sayr8.jar exited with code 1
, as it would be much more clear...
Hi @jonathanpeppers , I've fixed the issue, the issue underlies with the firebase packages, playservices, and androidx when I checked the verbose log but I cannot pinpoint it so what I did was I uninstalled all firebase packages, androidx, and googleplayservices and cleanly install the packages I need. Thanks for the help.
This bug/something related to this bug gave me a couple of days of headache.
When updating from level 28 to level 29 I got this bug. There was a conflict between my project manifest and obj/debug/100/AndroidManifest.
I fixed it with tools:node="replace". However, this fix caused my firebase implementation to stop working (I suspect it has to do with the receiver registrations in the manifest?).
I have now replaced tools:node="replace" with tools:replace="android:label, android:debuggable". and this works fine for debugging.
But, this comment from Yves-Be is a concern: "The attribute still gave an error when doing a release build, since the debuggable attribute is not included then"
Does anyone have an idea on the cause of the conflict and how to get around it?
@erikhornstrom if you look in obj/Debug/lp/map.cache
you should be able to figure out which Library the obj/Debug/lp/100/AndroidManifest.xml
came from . It will be the 100th line (starting at 0). Once you have that information you can post which Nuget/Library has the issue. If its one of our maintained nugets we can take a look. If its a third party Nuget then you will need to contact the maintainer and let them know they have a problem.
Normally this problem happens when stuff for and "app" is included in the library project manifest. Ideally nuget package maintainers should NOT be including app specific stuff (like android:debuggable) in their library manifest files.
As for release builds I'm not sure how to get around this. We'd have to investigate further.
@dellis1972 I've found the map.cache in \obj\Debug\100\lp. The package, if starting from 0, is Xamarin.Firebase.Datatransport. It seems to be a dependency of Xamarin.Firebase.Messaging. I now have the latest stable version of the Messaging nuget installed but I know we first encountered the conflict issue with 71.1740.4, which was the package we had installed when we did our update to Android 10.
EDIT: The strange thing is that I tried to download the Xamarin Firebase sample project "FCMNotifications", updated all nugets to the latest versions and changed target version to Android 10 and do not get any manifest conflicts and Firebase works as expected.
EDIT2: @dellis1972 I was a bit eager fixing the issue and just copy-pasting. There does not seem to be a conflict with android:debuggable. I removed the replace of the debuggable-attribute, kept the replace for label and allowBackup and there are no issues - no conflicts and debugging works just fine.
The docs on manifest merger https://developer.android.com/studio/build/manifest-merge might help here.
Adding
tools:replace="android:label, android:debuggable"
to the application element of the AndroidManifest.xml in the app might help
Saved my day sir
Most helpful comment
The docs on manifest merger https://developer.android.com/studio/build/manifest-merge might help here.
Adding
tools:replace="android:label, android:debuggable"
to the application element of the AndroidManifest.xml in the app might help