Edit

.NET for Android error XA5304

Example messages

error XA5304: Invalid AssemblyStore compression level '0'. The value must be between 1 and 22.

Issue

The $(_AndroidAssemblyStoreCompressionLevel) MSBuild property was set to a value outside the valid Zstandard compression level range of 1–22.

Solution

Set $(_AndroidAssemblyStoreCompressionLevel) to an integer between 1 and 22 (inclusive).

Optimized builds ($(Optimize) is true) default to the maximum compression level of 22 to reduce application size. Non-optimized builds default to level 3, which matches the Zstandard library default and provides faster build times. You can explicitly set $(_AndroidAssemblyStoreCompressionLevel) to override either default.

Higher values produce a smaller AssemblyStore at the cost of longer build times. Zstandard decompression speed is independent of the compression level, so the selected level does not affect application startup performance.