Xamarin Forms 错误 APT1000:在需要项目的位置找到标签 ID (Android)

tec*_*hie 4 admob xamarin.android xamarin xamarin.forms

我正在尝试将 Google Ads 与该软件包一起使用MarcTron.AdMob

安装后,我需要安装一些依赖项并更新一些软件包,正如它所说的那样:

Xamarin.AndroidX.Browser
Xamarin.Google.Android.Material
Xamarin.AndroidX.Lifecycle.LiveData
Xamarin.AndroidX.Legacy.Support.V4
Run Code Online (Sandbox Code Playgroud)

但是在我安装/更新所有这些依赖项之后,我再次编译并收到错误:

2>myproject.Android\obj\Debug\100\lp\111\jl\res\values\values.xml(1482): error APT1000: Attribute "android:translationX" has already been defined
2>myproject.Android\obj\Debug\100\lp\111\jl\res\values\values.xml(1486): error APT1000: Attribute "android:translationY" has already been defined
2>myproject.Android\obj\Debug\100\lp\111\jl\res\values\values.xml(1489): error APT1000: Attribute "android:translationZ" has already been defined
2>myproject.Android\obj\Debug\100\lp\83\jl\res\values\values.xml(4): error APT1000: Found tag id where item is expected
2>myproject.Android\obj\Debug\100\lp\82\jl\res\values\values.xml(4): error APT1000: Found tag id where item is expected
2>myproject.Android\obj\Debug\100\lp\76\jl\res\values\values.xml(4): error APT1000: Found tag id where item is expected
Run Code Online (Sandbox Code Playgroud)

我已经做了什么:

  • 清理项目并重新编译;
  • 请在此处遵循此解决方案;
  • colors.xml删除了我的资源中的空白styles.xml(这是我看到的另一个解决方案);
  • 更改 API 级别(28 - 9.0 和 29 - 10.0)。
  • 降级软件包。

什么都没起作用。

我尝试使用Xamarin.Firebase.Ads代替,MarcTron.AdsMob但我出现了同样的错误。

这是什么错误?我该如何解决它?我确实需要在应用程序上放置广告,但由于此错误我无法继续该项目。

小智 11

就我而言,在项目属性的 Android 选项中检查“使用增量 Android 打包系统 (aapt2)”解决了该问题。