Reduce App size

Xamarin End of Life Announcement

Anyline has been a longstanding provider of the Mobile SDK for Xamarin, catering to developers' needs for several years. As of autumn 2022, we have seamlessly transitioned our support to encompass the SDK for .NET (MAUI), recognized as the official successor to Xamarin.

In alignment with Microsoft’s recommendation to migrate from Xamarin to .NET, and considering Microsoft’s cessation of support for Xamarin by May 2024, Anyline will discontinue the release of any additional updates, including new features or bug fixes, for Anyline Mobile SDK for Xamarin.

Please find the Anyline Mobile SDK for .NET here.

By default, the Anyline SDK ships trained models for all the supported use cases. This will increase your app size significantly, but there is a simple way to remove the assets you do not need.

These are the modules you will need for each technical capability:

Technical Capability Module

VIN

ocr

Container

ocr

OCR

ocr

Barcode

barcode

Meter

energy

Universal ID

id

MRZ

id

Japanese Landing Permission

id

License Plate

license_plate

TIN

tire

Tire Size

tire

Commercial Tire ID

tire

Include List

If you only want to include specific assets, add the following Target to your project’s .csproj file.
In ModulesToKeep, list all the modules that you want to keep and divide them by the delimiter ‘;‘.

For example, add the following if you want to keep Container and Barcode:

Android
<Target Name="FilterAnylineAssets" BeforeTargets="_CreateBaseApkWithAapt2">
	<MSBuild
			Properties="ModulesToKeep=ocr;barcode"
			Projects="$(MSBuildProjectFile)" Targets="_RemoveAnylineModules"
	/>
</Target>
iOS
<Target Name="FilterAnylineAssets" BeforeTargets="_CreateAssetPackManifest">
	<MSBuild
			Properties="ModulesToKeep=ocr;barcode"
			Projects="$(MSBuildProjectFile)" Targets="_RemoveAnylineModules"
	/>
</Target>

And you are done! Your final app will contain only the modules specified above.

Exclude List

For explicitly excluding modules, add the following Target to your project’s .csproj file, and keep on this list to be removed only the scan modes you do not need:

Android
<Target Name="RemoveModules" BeforeTargets="_CreateBaseApkWithAapt2">
	<RemoveDir Directories="$(ProjectDir)obj\**\assets\anyline\module_id" />
	<RemoveDir Directories="$(ProjectDir)obj\**\assets\anyline\module_license_plate" />
	<RemoveDir Directories="$(ProjectDir)obj\**\assets\anyline\module_anyline_ocr" />
	<RemoveDir Directories="$(ProjectDir)obj\**\assets\anyline\module_energy" />
	<RemoveDir Directories="$(ProjectDir)obj\**\assets\anyline\module_barcode" />
	<RemoveDir Directories="$(ProjectDir)obj\**\assets\anyline\module_tire" />
</Target>
iOS
<Target Name="RemoveModules" BeforeTargets="_CreateAssetPackManifest">
	<RemoveDir Directories="$(AppBundleDir)\AnylineResources.bundle\module_id" />
	<RemoveDir Directories="$(AppBundleDir)\AnylineResources.bundle\module_license_plate" />
	<RemoveDir Directories="$(AppBundleDir)\AnylineResources.bundle\module_anyline_ocr" />
	<RemoveDir Directories="$(AppBundleDir)\AnylineResources.bundle\module_energy" />
	<RemoveDir Directories="$(AppBundleDir)\AnylineResources.bundle\module_barcode" />
	<RemoveDir Directories="$(AppBundleDir)\AnylineResources.bundle\module_tire" />
</Target>

Now, your final app will contain all the Anyline modules, except the ones specified in your .csproj file.