Preparing your Android Unity game for Google’s 64-bit requirements

Leonard Lin
4 min readJul 8, 2019

--

Why do you have to make your Unity Android game 64-bit compatible?
1) Because Google requires it by August 2019 (next month).
2) Users on 64-bit devices should see a performance boost (as IL2CPP scripting compiled ahead of time and not at run-time).

Starting in August 2019:

All new apps and app updates that include native code are required to provide 64-bit versions in addition to 32-bit versions when publishing to Google Play.
Extension: Google Play will continue to accept 32-bit only updates to existing games that use Unity 5.6.x or older until August 2021.

Starting in August 2021:

Google Play will stop serving apps without 64-bit versions on 64-bit capable devices, meaning they will no longer be available in the Play Store on those devices.
This will include games built with Unity 5.6.x or older.

1. Download and Setup Android NDK

The Android NDK (Native Development Kit) used to be optional but we’ll need it to build 64-bit Android apps.

Where to download and set the path for the Android NDK

In your Unity editor, go to Edit > Preferences > External Tools > Android > NDK > Click “Download”.

I tried to download the NDK via Android studio but Unity wants a specific version so it’s best to download from within Unity’s editor. The NDK version used at the time of writing is version 16b.

After downloading the zip file, you can save it to a preferred location. I saved it to my D: because I have a lot more space there. Just make sure you know where to copy the path (e.g. D:\android-ndk-r16b) so you can set it in your Unity Editor > Edit > Preferences > External Tools > Android > NDK

2. Make sure you have the right SDK platforms installed

Google announced in this blog post that new applications will be required to have a target API level of 28 (Android 9.0) beginning in August 2019. Existing apps have till November 2019 to upgrade to API level 28.

Android Studio > Tools > SDK Manager

Go to Android Studio > Tools > SDK Manager; Make sure you have Android 9.0 installed.

3. Build Settings

Build Settings for 64-bit Android in Unity

Scripting Backend — Change Mono to IL2CPP (which stands for “ Intermediate Language To C++”). This is where the NDK we installed earlier comes into play.

Target Architectures — Make sure ARM64 is checked. This option only becomes selectable once you have set the scripting backend to IL2CPP.

Android App Bundles (optional) — I updated my Unity to 2018.3 to test out Android App bundles. There are probably a few reasons why you might not want to use this just yet:

1) Android App Bundles (.aab) are only for Google Play. If you’re distributing to other Android stores, you’ll need uncheck “Build App Bundle” (in the Build Settings window) and choose “Split APKs by target architecture” (under Other Settings).

2) The App Bundle takes longer to build. The app bundle also doesn’t have any advantages for Unity apps beyond reducing the APK size by separating out the resources needed for different CPU architecture so “Split APKs by target architecture” achieves the same results.

Split APKs by target architecture (optional) — I saved about 13 MB on my APK file size using this option instead of FAT APK (all architectures supported in a single APK file).

Minimum SDK Level — API level 21 (Android 5.0 Lollipop) is where 64-bit support was introduced. However, setting this minimum API level excluded about 10.2% of active Android phones and 13% of Android tablets (something to consider). *Edit: thanks to dm.bondarev for pointing out that we can leave the Min SDK level lower than 21; 32-bit devices will just get the 32-bit APKs.

Target SDK Level — Set target API level of 28 (Android 9.0).
Changing the Target API Level to “Automatic (Highest Installed)” will set target Sdk version in your manifest to the latest SDK Platform you have installed within your Android SDK (in our case, API level 28).

If your target SDK level is lower than that of the user’s phone’s, they will receive a security warning when installing your app.

Final Notes:

I had some problems trying to install the new 64-bit APK on my device. I had to do a manual uninstall of the game app (Phone > Settings > Apps > Your App > Uninstall); then reinstall my game to get it to install correctly.

--

--

Leonard Lin

Principal Software Engineer. Indie game developer. Founder @ Gamenami.