Edit

.NET for Android warning XA0149

Example messages

warning XA0149: Ignoring legacy Xamarin.Android environment file '__AndroidEnvironment__abc123' from NuGet package 'Some.Old.Package' version '1.2.3' in assembly '/path/to/Some.Old.Package.dll'. Environment files from Xamarin.Android class libraries are not supported in .NET for Android. Use a newer version of this NuGet package or notify the library author.

warning XA0149: Ignoring legacy Xamarin.Android environment file '__AndroidEnvironment__abc123' in assembly '/path/to/SomeLibrary.dll'. Environment files from Xamarin.Android class libraries are not supported in .NET for Android. Use a newer version of this assembly or notify the library author.

Issue

A referenced assembly (typically from an older Xamarin.Android class library or a NuGet package targeting MonoAndroid) contains an embedded __AndroidEnvironment__* resource. .NET for Android does not consume environment files contributed by class libraries via this legacy mechanism, so the file is being ignored.

This is closely related to the NU1703 warning that NuGet emits for packages still targeting the deprecated MonoAndroid framework.

Solution

Update to a version of the NuGet package or library that targets net-android (.NET for Android). If you maintain the library, rebuild it as a .NET for Android class library so that any environment variables are produced in the supported .net/env/ AAR layout.

If the environment variables are required by your application, declare them directly in your app project using an @(AndroidEnvironment) item:

<ItemGroup>
  <AndroidEnvironment Include="env.txt" />
</ItemGroup>