Android Deployment

Android Deployment

Requirements

General information about setting up a development environment to build and run Unity projects for Android can be found here: https://docs.unity3d.com/Manual/android-sdksetup.html.

For older Unity Editor versions, you can find corresponding documentation by selecting from the Version drop-down menu. For example: https://docs.unity3d.com/2017.4/Documentation/Manual/android-sdksetup.html

The minimum requirements for building and running WRLD Unity SDK projects on Android are as follows:

  • The Android SDK is installed.
  • Android API >= Level 23 and SDK Tools >= 24.0.3 are installed via SDK Manager.
  • Java Development Kit JDK 1.8 or above is installed.
  • If building with arm64 support, or using the IL2CPP scripting backend, the appropriate Android Native Development Kit (NDK) is installed.
  • The paths for JDK, Android SDK and Android NDK have been set correctly. See “Change the JDK”, “Change the SDK” and “Change the NDK” here.
  • A compatible device running Android 4.4.4 or higher is connected, with USB debugging enabled.

64-bit support

The WRLD Unity SDK can be built with 64-bit native libraries, allowing compliance with Google Play submission requirements.

Unity requires the Android Native Development Kit (NDK) for 64-bit builds. The version of NDK required is specific the the Unity Editor version. For Unity 2019.3, this is NDK r19.

If necessary, older versions of NDK can be downloaded from https://developer.android.com/ndk/downloads/older_releases. Unzip the downloaded NDK package to some directory, then that directory used to configure the Unity NDK location as described under Change the NDK.

Unity only supports the IL2CPP scripting backend when building for arm64, not the default Mono. Ensure IL2CPP is selected for Scripting Backend in the Android Player Settings.

Additionally, under Target Architecture, check ARM64. Optionally, ARMv7 can also be checked, in which case a “fat apk” will be built that contains both 32-bit (armv7) and 64-bit (arm64) native libraries - this is likely what you will want for Google Play publishing, though the resultant apk size will be larger.

Deploying to an Android Device

  1. Open Build Settings (Ctrl + Shift + B).
  2. Select the Android platform and click Switch Platform. This may take some time to complete while assets are rebuilt for Android.
  3. Select Player Settings... to open Android Settings in the right-hand Inspector panel.
  4. Set Company Name, Product Name, Package Name, Version and Bundle Version as appropriate for your app.
  5. Set Minimum API Level to Android 4.4 'KitKat' (API level 19) or above.
  6. Set Scripting Backend to IL2CPP. Alternatively, if 64-bit (arm64) support is not required, Mono may be selected for faster build times.
  7. Under Target Architecture check ARMv7 and/or ARM64 (see 64-bit Support above). Ensure x86 is not checked.
  8. From Build Settings select Build And Run. Specify a name and directory for the resultant .apk file.
  9. The build process should then create the .apk and launch on your connected Android device.

The .apk can also be installed on a device using adb, located in in the platform-tools sub-directory of the Android SDK installation.

./adb.exe install -t <package_file_pathname>

Android Permissions

The WRLD Unity SDK uses the following permissions.

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
v0.8.17