Skip to main content

How to Export Your Project With Godot Engine for Android

Michael is a certified Coding Instructor who has taught thousands of students how to code in the software development space.

Welcome everyone. Here we're going to go ahead and take a look at how to export your project for Android. You do not need to have a project ready to go but, if you do, feel free to use that project.

Now, before jumping into what we need to do, I want to point out that if you go down to display, Window, and your project settings, you can determine whether your app launches in portrait or landscape.

Install JDK

The first thing we're going to need to do is open up the OpenJDK link. At first glance you may notice that there are three version presented to you on this page, so which do you choose? This will depend on if you just want to make an APK file that you can side load, or an AAB file for uploading to the Google Play Store.

If you only want an APK file, you can get away with using JDK8. If you feel like you might want to upload to the Google Play Store sometime in the future, you will need to get JDK11. To avoid any confusion, JDK11 will also allow you to create an APK file so there's no real reason to go with JDK8 unless you really want to.

For the JVM we can use the default selection of HotSpot and advance to downloading our file. Once downloaded, run the file we got and install OpenJDK. Make sure to add Java to your PATH when presented with the opportunity.

Install Android Studio

With our JDK installed, we can move on and get Android Studio as we will need the Android SDK out of there. And there are a few different ways or different ways of going getting this. I prefer using Android Studio, which is something we can easily obtain and quickly.

Just hit download Android Studio, agree to the terms and conditions, download and just run through the installation. Once you hit finish, it should open up and you should be good to go from there.

Set SDK Path

We can actually jump over to our project now. And we can go to editor settings, and we can go over here to inside the general tab here, find export Android. It should be at the very bottom of the list. And you're going to need to locate your SDK path.

The Debug Key Store will be generated momentarily as it probably wouldn't have come with it. So if you just open up your folders, you're going to navigate yourself to your app data sets, your C drive users, your username app data, which may be a hidden folder.

And if it is, you can just hit the Windows key and type percent app data percent. And that'll also find your way here. And we just go back up to App Data local and we see Android. And that goes to the SDK folder. We just want to make sure we have our SDK folder selected. Open it up and hit Select Current folder.

Debug Keystore

And now for the Debug Key Store, we're actually going to need to generate this key and we're going to use the default Key Store user and password here that they're using. All right, so for our Key Store, I'm going to go ahead and open up the client prompt in the location of our key tool that we're going to use. So that's just going to be by default in your C drive program files, Android, and you see a JDK folder and then open up the Microsoft folder inside of Vin.

And if you were to scroll down, you'll find keyword exe. This is the location we want to open up our command prompting. So I'm just going to right click here and could open the Windows Terminal. But I'm just going to type CMD and hit Enter. And this will just open up a command prompt already in this directory.

Generate Debug Key: keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000

We're going to use the key tool executable that we have in here, which again is just sitting right here in your folder, and we're going to generate a Debug Key Store key. And we're going to use Android and Android Debug, which is the default. Here we are basically setting the validity for 10,000 days. You can always set that larger if you really want to, but 10,000 should be relatively fine.

Go ahead and hit Enter and you see it's going to ask you for your first and last name. So make sure you put some actual information in here, even if it's not necessarily yours, but you may as well put yours in there, right? It doesn't hurt and it's specifically your debug key anyway, just on your name organization if you really have one, city, state, country code and all that.

Once you have generated your debug key, you can go ahead and take that file, and place it somewhere on your computer. Back in your Editor Settings, go ahead and navigate to the debug key and select it.

Release Keystore

Now, if you want to create one for release, then it's going to be almost exactly the same.

Generate Release Key: keytool -v -genkey -keystore mygame.keystore -alias mygame -keyalg RSA -validity 10000

This time when we got mygame.keystore here, you can go ahead and put whatever name you want for your Key Store. Now for mygame, this will be your password. Make sure to keep those in mind for when you're doing an actual full release because you're going to need to use this information to sign your app with your actual Key Store, not a debug, which is required if you want to upload to something like the Google Play Store.

APK Export

So once you have your Debug key store selected here in our settings, we can then go up to Project Export, create an Android Preset, and after hitting Add you should be able to select Android in the drop down. This is with an APK. An AAB is going to involve a few more steps than what we're using here.

There is no need to fill in the debug information as this will be pulled from our editor settings we filled in earlier. But, if you're using a release key, this is where you're going to have to select your key and fill in your user and password that you selected with that key. I also like to select Clear previous Install just so that it overwrites it on the device.

If you require any specific permissions, they're going to be down here at the bottom. These are the permissions that pop up when you go to install an app such as network access for using a users WiFi access. You can then just go ahead and just hit Export Project. Make sure to uncheck debug if you want to sign your apk with your release key.

AAB Export

In order to do an AAB export for an app store, we will need to head on up to Project and select Install Android Build Template. Once this has completed, the rest of the exporting is nearly the same. We will need to make sure that export format has been set to export an AAB file, as well as select Use Custom Build. This must be enabled.

This content is accurate and true to the best of the author’s knowledge and is not meant to substitute for formal and individualized advice from a qualified professional.

© 2022 Michael McGuire