Home > Mobile >  Xamarin Forms Error APT1000: Found tag id where item is expected (Android)
Xamarin Forms Error APT1000: Found tag id where item is expected (Android)

Time:10-16

I'm trying to use Google Ads with the package MarcTron.AdMob.

After I install it, I need to install some dependencies and update some packages, as it said me to do:

Xamarin.AndroidX.Browser
Xamarin.Google.Android.Material
Xamarin.AndroidX.Lifecycle.LiveData
Xamarin.AndroidX.Legacy.Support.V4

But after I install/update all this dependencies, I compile again and get the error:

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

What I already did:

  • Cleaned the project and compiled it again;
  • Follow this solution here;
  • Removed the whitespaces of colors.xml and styles.xml inside my Resources (it was another solution that I saw);
  • Change the API level (28 - 9.0 and 29 - 10.0).
  • Downgrade the packages.

Nothing worked.

I tried to using Xamarin.Firebase.Ads instead of MarcTron.AdsMob but the same error appears to me.

What is this error and how can I solve it? I really need to put ads on the application and I can't continue the project with this error.

CodePudding user response:

I was running into a similar issue when using Migrate to AndroidX. What I did to fix it was I checked and saw that some of the Android Nuget packages didn't migrate over to AndroidX. So you may be missing some AndroidX Nuget Packages. Add some of them and see if it builds.

CodePudding user response:

The solution was creating a blank project and copy/paste all my classes, folders, resources...

I really wanted to solve this because in several sites has the same question that I did, so it was good to help the community. For now, the solution was that.

  • Related