Xamarin.Android,AndroidManifest.xml,AndroidManifestMerger,xmlns:tools模式,始终手动替换 [英] Xamarin.Android, AndroidManifest.xml, AndroidManifestMerger, xmlns:tools schema, replace always manually

查看:104
本文介绍了Xamarin.Android,AndroidManifest.xml,AndroidManifestMerger,xmlns:tools模式,始终手动替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编译Xamarin Forms Android应用程序visual studio时,向我显示AndroidManifest.xml冲突的错误列表,例如:

When compile my Xamarin Forms Android application, visual studio, show me an error's list of AndroidManifest.xml conflict, for example:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(3,3): Error AMM0000:  is also present at AndroidManifest.xml:14:9-41 value=(@string/app_name). (AMM0000)

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(3,3): Error AMM0000:  Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:19:3-79:17 to override. (AMM0000)

因此,我从debug文件夹中打开AndroidManifest.xml,替换为tools:replace到应用程序标记中,将工具架构添加到manifest标记中,保存它,重新编译我的应用程序,并且它运行时没有错误.

So i open AndroidManifest.xml from debug folder, replace with tools:replace into application tag, add tools schema into manifest tag, save it, recompile my application and it run without error.

但是,每当我编译Xamarin Forms Android应用程序时,都必须手动执行前面的步骤.

我还将< AndroidManifestMerger> manifestmerger.jar</AndroidManifestMerger> 添加到我的Android .csproj

I also add <AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger>, into my Android .csproj

此问题显示为DEBUG和RELEASE模式!

This issue is showed into DEBUG and RELEASE mode!!

环境

  • Visual Studio Community 2019 for Mac版本8.6.4
  • Xamarin表格= 4.7.0.968
  • Xamarin.Android =版本10.3.1.4

推荐答案

这是问题Xamarin Forms 4.6.0.967及更高版本.对我来说,它是通过使用Honeywell.BarcodeReader NuGet软件包引起的.

This is an issue with Xamarin Forms 4.6.0.967 and above. To me, it was provoked by using the Honeywell.BarcodeReader NuGet package.

一些AndroidX软件包正在使用manifestmanger.jar覆盖默认的Xamarin(很快就会成为旧版)清单合并.

Some AndroidX packages were overwriting the default Xamarin (soon to be legacy) manifest merger with the manifestmerger.jar.

一种解决方法是降级到Xamarin Forms 4.6.0.847,或修改您的AndroidManifest.xml使其具有如下应用程序元素:

A workaround is to downgrade to Xamarin Forms 4.6.0.847, or to modify your AndroidManifest.xml to have an application element like this:

<application android:label="@string/app_name" tools:replace="android:label" ...

或者还有更多冲突:

<application android:label="@string/app_name" tools:node="replace"...

您还需要将以下名称空间作为属性添加到清单中:

You will also need to add the following namespace to the manifest as an attribute:

xmlns:tools="http://schemas.android.com/tools"

这篇关于Xamarin.Android,AndroidManifest.xml,AndroidManifestMerger,xmlns:tools模式,始终手动替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆