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
- Open Build Settings (
Ctrl + Shift + B
). - Select the Android platform and click
Switch Platform
. This may take some time to complete while assets are rebuilt for Android. - Select
Player Settings...
to open Android Settings in the right-hand Inspector panel. - Set
Company Name
,Product Name
,Package Name
,Version
andBundle Version
as appropriate for your app. - Set
Minimum API Level
toAndroid 4.4 'KitKat' (API level 19)
or above. - Set
Scripting Backend
toIL2CPP
. Alternatively, if 64-bit (arm64) support is not required,Mono
may be selected for faster build times. - Under
Target Architecture
checkARMv7
and/orARM64
(see 64-bit Support above). Ensurex86
is not checked. - From
Build Settings
selectBuild And Run
. Specify a name and directory for the resultant .apk file. - 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.