Start a Xamarin Android Project
Warning
The Xamarin SDK is deprecated. For more details, contact Support.
For Xamarin Android, you should be aware that Xamarin Android runs two garbage collectors: one for Java and one for .NET. This makes any garbage collection operation very slow relative to all other platforms and can affect performance. Try to avoid any unnecessary allocations.
To specify which native libraries are built into your Xamarin Android project you need to add the following to your .csproj file:
`<AndroidSupportedAbis>armeabi-v7a;x86;arm64-v8a</AndroidSupportedAbis>`
This results in native libraries included for all of the necessary architectures.
As with other platforms, you need to include architecture-specific native libraries for Xamarin Android. Do not include the Android JNIs. Instead, include the shared object libraries that can be found in the Xamarin/Libraries/Android/arm64-v8a, Xamarin/Libraries/Android/armebi-v7a and Xamarin/Libraries/Android/x86 folders. The following rules apply:
- If you are using
FM.LiveSwitch.AudioProcessing.dll, includelibaudioprocessingfm.so. - If you are using
FM.LiveSwitch.OpenH264.dll, includelibopenh264fm.so. - If you are using
FM.LiveSwitch.Opus.dll, includelibopus.soandlibopusfm.so. - If you are using
FM.LiveSwitch.Vpx.dll, includelibvpxfm.so. - If you are using
FM.LiveSwitch.Yuv.dll, includelibyuvfm.so.
If you want to be safe, you can include the entire lib folder in your project. This ensures that you always have the correct native libraries.
For release builds, we strongly recommend using AOT (ahead-of-time) compilation, as it significantly improves the initial connection time. To enable AOT, add:
<AotAssemblies>True</AotAssemblies>
<EnableLLVM>True</EnableLLVM>
to the PropertyGroup that targets Release (for example, <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">).
Permissions
You need to add permissions to your manifest as follows:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- largeHeap is necessary to avoid OOM errors on older devices -->
<application android:theme="..." android:label="..." android:largeHeap="true"></application>