Skip to content

Instantly share code, notes, and snippets.

@starkindustries
Last active February 25, 2023 18:53
Show Gist options
  • Select an option

  • Save starkindustries/cbc8664789559403ec8fa3a6c559a40c to your computer and use it in GitHub Desktop.

Select an option

Save starkindustries/cbc8664789559403ec8fa3a6c559a40c to your computer and use it in GitHub Desktop.
Godot for Android Development

Godot for Android Development

Contents

Install OpenJDK 11

OpenJDK is required to build Android projects. Download and install OpenJDK 11.

Configure Android Studio SDK Settings

  1. Install and launch Android Studio.
  2. In the Welcome to Android Studio window, click More Actions > SDK Manager.

godot-android-1

  1. At the top of the window, make a note of the Android SDK Location. You will need to specify that location in Godot editor. It should look something like this: C:\Users\username\AppData\Local\Android\Sdk
  2. In the SDK Platforms tab, verify that Android 11.0 R is checked.
  3. In the SDK Tools tab, find the list items for NDK (Side by side), Android SDK Command-line Tools, and CMake. Check them if they are unchecked.

image

  1. Click OK. Confirm the download and accept the license agreements to complete the installation.

Create a Debug Keystore

A debug keystore file is required to digitally sign and test apps on a device. If a keystore already exists, it will be at this location:

  • Microsoft Windows: C:\Users\$username\.android\debug.keystore
  • Linux/macOS: ~\.android\debug.keystore

If the debug.keystore file does not exist, create one:

  1. Launch Android Studio.
  2. In the Welcome to Android Studio window, click More Actions > Import an Android Code Sample.

image

  1. Select the Ndk > Hello GL2 sample from the list and click Next.

image

  1. Choose a location for the project and click Finish.
  2. Wait for the project to load and sync with Gradle, then click Build > Make Project from the Android Studio menu bar.

image

  1. Wait for the build to finish, then verify a debug.keystore file was created in the appropriate directory. If you get a Java.lang error, you likely did not install OpenJDK correctly.

image

Configure Android SDK in Godot Editor

  1. Launch the Godot editor and open a project.
  2. Select Editor > Editor Settings.
  3. In the Editor Settings window, select the Export > Android item in the left panel.
  4. In the right panel, go to the text box for Android Sdk Path and enter the path to the Android SDK.
  5. In the text box for Debug Keystore enter the path to the debug.keystore file. See example:

image

  1. Godot 4 requires export templates to be downloaded. Click Editor > Manager Export Templates.

image

  1. Click Download and Install.

image

  1. Click Project > Export. The Export menu should show an Android preset.

image

Enable Developer Mode on Android Device

For Android 9 and later, tap Settings > About Phone. Then tap Build Number option seven times. Connect the device to the PC and tap Allow USB debugging on the phone.

Build Godot Project to Mobile Device

With your phone attached, a little Android icon should appear in the Godot editor. Click that icon and the game will build to your device.

image

References

https://docs.godotengine.org/en/stable/tutorials/export/exporting_for_android.html

https://developer.android.com/games/engines/godot/godot-configure

https://developer.android.com/studio/debug/dev-options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment