我正在嘗試將 Google Ads 與包一起使用MarcTron.AdMob。
安裝后,我需要安裝一些依賴項并更新一些軟體包,正如它所說的那樣:
Xamarin.AndroidX.Browser
Xamarin.Google.Android.Material
Xamarin.AndroidX.Lifecycle.LiveData
Xamarin.AndroidX.Legacy.Support.V4
但是在我安裝/更新所有這些依賴項后,我再次編譯并得到錯誤:
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
我已經做了什么:
- 清理工程,重新編譯;
- 在此處遵循此解決方案;
- 洗掉了我的資源中
colors.xml和styles.xml里面的空格(這是我看到的另一個解決方案); - 更改 API 級別(28 - 9.0 和 29 - 10.0)。
- 降級軟體包。
沒有任何效果。
我嘗試使用Xamarin.Firebase.Ads而不是,MarcTron.AdsMob但在我看來同樣的錯誤。
這是什么錯誤,我該如何解決?我真的需要在應用程式上投放廣告,但出現此錯誤我無法繼續該專案。
uj5u.com熱心網友回復:
我在使用 Migrate to AndroidX 時遇到了類似的問題。我所做的修復是我檢查并看到一些 Android Nuget 包沒有遷移到 AndroidX。所以你可能會遺漏一些 AndroidX Nuget 包。添加其中一些,看看它是否構建。
uj5u.com熱心網友回復:
解決方案是創建一個空白專案并復制/粘貼我所有的類、檔案夾、資源......
我真的很想解決這個問題,因為在幾個網站上都有和我一樣的問題,所以幫助社區是件好事。目前,解決方案是這樣。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/315315.html
標籤:沙马林 xamarin.forms 安卓系统 广告
上一篇:在Xamarin.Forms上為每個專案安裝Nuget
下一篇:交叉兼容差異xamarin/C#
