question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Types from Xamarin.AndroidX.AppCompat.Resource not mapped correctly for preview03 packages

See original GitHub issue

After upgrading to the preview03 versions of the support packages builds started failing for my Xamarin Forms Android project with the following error message:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2105,5): error MSB4018: The "LinkAssemblies" task failed unexpectedly. 
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2105,5): error MSB4018: Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'AndroidX.AppCompat.Graphics.Drawable.DrawableWrapper' (defined in assembly 'Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null') with scope 'Xamarin.AndroidX.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve AndroidX.AppCompat.Graphics.Drawable.DrawableWrapper

The linker seems to be looking for the DrawableWrapper definition in the Xamarin.AndroidX.AppCompat assembly, which is where it was defined prior to the preview03 release of the support package. It seems this type along with a few others were moved into a new Android library, androidx.appcompat.appcompat-resources, so they are now located in a new assembly for the Xamarin Android support packages, Xamarin.AndroidX.AppCompat.Resources.

I was able to get the build working by adding a _AndroidXAssembly definition for Xamarin.Android.AppCompat.Resources in Xamarin.AndroidX.Migration.props, and also updating the AndroidX .NET Assembly column values to Xamarin.AndroidX.AppCompat.Resources in androidx-mapping.csv for the types:

AndroidX.AppCompat.Graphics.Drawable.AnimatedStateListDrawableCompat
AndroidX.AppCompat.Graphics.Drawable.DrawableWrapper
AndroidX.AppCompat.Content.Res.AppCompatResources
AndroidX.AppCompat.Widget.DrawableUtils
AndroidX.AppCompat.Widget.TintContextWrapper
AndroidX.AppCompat.Widget.VectorEnabledTintResources

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:31 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
Redthcommented, Nov 25, 2019

We are looking into this right now, thanks for your patience 😃

1reaction
moljaccommented, Dec 10, 2019

@Pitchaiyan

any solution or ideas will be much helpful for us.

Sure. But we need to reproduce the issue first (in order to fix it).

Downloaded it and testing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xamarin : No resource found that matches the given names ...
I developed an application on my virtual machine. I have no error during compilation. I uses Android.Support.Design, Android.Support.V4, Android ...
Read more >
AndroidX - Xamarin
Summary. This article introduced AndroidX and explained how to install and configure the latest tools and packages for Xamarin. Android ...
Read more >
Unable to deploy Xamarin Android App after 8.7 update
AndroidX.AppCompat.Resources is requiring this library: libmono-btls-shared.so, and that it has not been built properly with the latest Android.
Read more >
Build a new xamarin project and Android X error
Error NU1101 Unable to find package Xamarin.AndroidX.AppCompat. No packages exist with this id in source(s): Microsoft Visual Studio Offline
Read more >
Xamarin.AndroidX.AppCompat.Resources
Dear Xamarin Team,. Why this following error coming in my studio while running android application. I installed Xamarin.AndroidX.AppCompat.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found