Reference official tutorial:
https://docs.godotengine.org/en/stable/tutorials/export/exporting_for_android.html
1. Software to download#
OpenJDK 11+
https://adoptium.net/zh-CN/temurin/releases/?version=11
It is recommended to download the compressed package, unzip it, and then add the environment variable
JAVA_HOME
jdk11 storage folder, mine is C:\Program Files\Java\jdk11.0.18_10
Android Studio
https://developer.android.google.cn/studio?hl=zh-cn
After installing Android Studio, open it
Choose SDK 32.0.0 (default for Godot) and 30.0.3
Choose NDK r23c (23.2.8568313)
Choose CMake 3.10.2
2. Generate a key#
A debug keystore needs to be generated. Open cmd, switch to the bin folder of the jdk11 storage path, and run the following command
keytool -keyalg RSA -genkeypair -alias androiddebugkey -keypass android -keystore debug.keystore -storepass android -dname "CN=Android Debug,O=Android,C=US" -validity 9999 -deststoretype pkcs12
3. Add sdk location and debug key#
Open Godot, Editor → Editor Settings → Android
Add the Android SDK path, which is usually C:\Users\YourUsername\AppData\Local\Android\Sdk
The debug keystore is located in the bin folder
Keep the debug keystore username and password unchanged
androiddebugkey
android
4. Install export templates#
Download link for export templates
https://downloads.tuxfamily.org/godotengine/
Choose Godot_v4.0-stable_export_templates.tpz in the corresponding version
Project → Install Android Build Template
5. Export settings#
Project → Project Settings
Make sure to check Import STC ASTC
5.1 Debug export#
In the export settings
Check Use Gradle build (Target SDK can be overridden)
Target SDK is 30
If Use Gradle build is not checked, the target SDK cannot be overridden, and the default SDK 32.0.0 will be used to export the apk
Check arm64
Fill in the debug keystore location, username and password are the same as above
Modify the name and unique name, the format is shown in the image
Make sure to check Sign, otherwise the apk will not be installable
5.2 Release export#
If used for release
keytool -v -genkey -keystore mygame.keystore -alias mygame -keyalg RSA -validity 10000
The user is mygame
, please modify it yourself
The key needs to be set by yourself
When using Project Export, do not check Debug Export
Use Export All, click Publish