.NET for Android error XA2002

Example messages

error XA2002: Can not resolve reference: `Library2`, referenced by `Library1`. Please add a NuGet package or assembly reference for `Library2`, or remove the reference to `Library1`.

Issue

The project has a reference to Library1, and Library1 has a transitive dependency on Library2, but Library2 could not be found using any of the standard reference resolution lookup mechanisms.

Solution

In some cases, such as for projects ported from another target platform to .NET for Android, the Library1 reference might no longer be relevant. In those cases, the reference to Library1 can be removed.

In other cases, Library2 might be available as a NuGet package or other similar prebuilt library. To resolve the error in those cases, add the appropriate NuGet package or direct assembly reference to the project.

If neither of those possibilities applies, then Library2 is likely a framework class library assembly that is not available for .NET for Android. In that case, Library1 is not compatible for use with .NET for Android.