Exporting your Unity project as an APK

Export your Unity project by building an APK (for Android)

Are you planning to create a Unity game for mobile devices? Wondering how you can export your game and build it as an app on Android? Look no further — here’s a step-by-step guide to exporting your game onto your Android device.

If you’re looking for a way to test your game as you’re making it, check out Unity Remote — it’s an Android app that mirrors Unity Editor’s Game screen when you are in Play Mode. Once you’ve installed it, we have a guide covering how to get Unity Remote working on your devices.

APK files are Android installers

To install your game as an Android app, you need to export it as an APK file, upload it onto your Android device and run the file.

Installing an APK file on Android
How to install an APK file.

Fun fact: APK files are actually just ZIP files named with an .apk extension instead of the traditional .zip. You can change the extension of an APK to .zip and open it like you would open a ZIP file, but you can’t do much with the files inside.


Article continues after the advertisement:


Installing Android Build Support

For Unity to be able to export your game as an APK, you need to install the Android Build Support module on the Unity Editor that you are using to build your project.

Is Android Build Support installed on Unity?
Under the Installs tab of Unity Hub, if you find the circled icon below your editor version, that means that Android Build Support is installed for it.

If the editor version that you are using doesn’t have Android Build Support, you’re going to have to install it by clicking on the dropdown at the top-right corner of the editor version and selecting the Add Modules option.

Add Module in Unity Hub
If Add Modules is missing, that means your Unity version was not installed using Unity Hub. You will have to uninstall that version manually and reinstall it.

This will bring you to a screen with a list of modules available for that version of the Unity Editor. Select all of the modules under the Android Build Support dropdown, then click on the Next button to install them.

Android Build Support modules for Unity Remote
Installing additional modules was a lot harder before Unity Hub came along.

When it’s done, Android Build Support will be active on that version of the Unity Editor.

Setting the Build Platform

With Android Build Support installed, you will be able to switch the build platform of your project to Android. To do so, go to File > Build Settings and select the Android platform. Then, click on the Switch Platform button.

Switch your Build Platform in Unity
If the Switch Platform button is not there, that means your build platform is already set to Android.

Building the APK file

Once your platform is switched over to Android, the Switch Platform button should be replaced with a Build button. Click on the Build button, and Unity should prompt you for a location to save your APK file.

Save your APK file and upload it onto your phone. Then, open it on your phone to install it as an app!

Conclusion

If you run into a problem while exporting your APK, feel free to drop a comment describing your problems below. We do respond to comments on this blog, and we will reply to your comment with a list of possible solution(s). If your comment highlights a common issue that is relevant to this post, we will also update the post to mention the problem(s) you encountered, plus the suggested fixes.


Article continues after the advertisement:


There are 2 comments:

  1. I have had an issue with building an apk, which isn’t necessarily related to this tutorial. But hope someone have some kind of expertise.
    The problem :Login Authentication UI works perfectly on Unity Editor, but doesn’t work on an android device.

    So I have implemented all of the features that are displayed on the Sign In screen. Logging in with PLAYFAB credentials, Signing Up, Google authentication and Facebook authentication and Guest Login using the device id. Apple authentication is yet to be executed.

    However on my android device, only the google authentication button works i.e the google icon. When It’s clicked it logs into my google play games id and Sign up i.e creating a new account.

    THE PROBLEM (persists only on an android device):

    None of my other buttons work (Log in, Play as a guest, Facebook), well they don’t even interact like buttons anymore. Atleast if they were clickable/ interactable, I would have thought it’s happening because of the code or cross checked my functions.

    So this is where it’s more weird. I get different outcomes on different devices…
    UPDATE: On one device both Google and Facebook icons are interactable and google successfully authenticates, but on another device even though google is interactable, it’s not able to authenticate, while facebook isn’t interactable at all. However login and play as guest are consistently not interactable. While on the third device google is interactable and authenticates while facbook isn’t interactable.

    Where should I be looking to fix this? What possibly is going wrong here ?

    Hope I get some kind of response. Been stuck at it for days.

    Thanks for your time.

    1. Hey Anudeep, is it possible that in your Canvas, your buttons are being blocked by another element? If you have a transparent Image element (for e.g. a black fader), it will block clicks even though it is see-through.

      It may be working on certain devices and not others because different screen resolutions change the positioning of your UI elements, and may cause different objects to be blocked.

Leave a Reply

Your email address will not be published.