Midnight Deck Dash · Lesson 43 of 50 · Publishing · About 45 min
The ship's Android travel case needs an address, a build number and the correct package before it leaves the dock.

Download the projects from the course page. In Godot’s Project Manager, choose Import, select project.godot, and use Run Project (F5). Start from checkpoints/42 when the lesson builds on prior work, or copy the checkpoints/43 folder to try this lesson on its own. Read the file names in the steps before editing. Keep the checkpoint ZIP intact and make edits in an extracted working copy.

Build it step by step
Language and tools in this lesson ends_with(), begins_with(), split(), int(), is_valid_int(), package identity, version code.
-
Set up the Android tools
Use a desktop with Godot and matching export templates from Editor > Manage Export Templates. Install the Java and Android SDK tools in Godot's Android guide. In Editor > Editor Settings, search Android and point the Java and SDK fields to the installations.
Why it works Godot, its templates and the SDK need compatible versions. Follow the stable guide for your installed Godot version.
-
Create an Android preset
Open the full game project and choose Project > Export > Add > Android. Set a unique package ID your publisher controls, a display version such as 1.0.0, and an increasing integer version code. Enable Gradle and choose Android App Bundle for the store build.
Why it works The package ID links updates to the app. The version code orders its builds.
-
Check the target API and signing
As checked on 22 November 2026, ordinary phone app submissions to Google Play must target Android 16 API 36 or higher. Recheck Google before each release. The adult publisher follows Godot and Play App Signing instructions for their upload key, and keeps credentials on their managed machine.
Why it works The target API identifies the expected Android behaviours. The upload key authorises submissions and Play App Signing protects the key used for distribution.
-
Run the practice checks
Press F5 in checkpoint 43. Compare Check practice APK and Check production bundle sample. In validate_bundle(), read the filename and return guards.
if not filename.ends_with(".aab"):Why it works The suffix check catches a common labelling mistake. Only the real export and Play's validation prove package format and signing.
-
Export a release bundle
Back in the full project, choose the Android preset and Export Project with debugging off. Save the signed AAB to a versioned output folder. The publisher can upload it to Play Console on a test track such as Internal testing and install the resulting app on a phone.
Why it works A local debug APK is useful for experiments. Google Play uses the AAB to deliver suitable APKs for different devices.
-
Check production access
Record the version code and track. The publisher follows Play Console's launch checklist. For a new personal account subject to the rule, the closed test needs at least 12 testers continuously opted in for 14 days before an application for production access.
Why it works A working internal install confirms a build. Closed testing and production approval are separate steps where applicable.
Watch the values change
-
Try APK The name ends in .apk.
What you see. The lab requests a signed store AAB. -
Try bundle example The suffix, identifying label and version example pass.
What you see. The lab requests official signing and eligibility checks. -
Reuse a code The last and new code both equal 5.
What you see. The lab requests an increase.
Predict before you run Does renaming a debug APK to .aab make it an Android App Bundle?
Reveal the answer
No. The extension is a label and Godot must export the actual AAB format.
Complete checkpoint
Each button produces a different result for its APK, AAB or reused-code case.
main.gd
extends Control
const Lab = preload("res://release_lab.gd")
const TITLE := "Prepare an Android App Bundle"
var ui: VBoxContainer
func _ready() -> void:
ui = VBoxContainer.new()
ui.set_script(Lab)
add_child(ui)
ui.start(TITLE)
build()
func build() -> void:
ui.say("These are practice checks. The full project exports the signed store file.")
ui.option("Check practice APK", show_case.bind("test.apk", "com.example.deck", "6", 5))
ui.option("Check production bundle sample", show_case.bind("harbour.aab", "org.samplecrew.harbour", "6", 5))
ui.option("Check reused version code", show_case.bind("harbour.aab", "org.samplecrew.harbour", "5", 5))
func show_case(file: String, package_id: String, code: String, previous: int) -> void:
ui.say(validate_bundle(file, package_id, code, previous))
func validate_bundle(filename: String, package_id: String, code: String, previous: int) -> String:
filename = filename.to_lower()
if not filename.ends_with(".aab"):
return "Use a signed Android App Bundle (.aab) for the store."
if package_id.begins_with("com.example.") or package_id.split(".").size() < 3:
return "Replace the example ID with your publisher's unique package ID."
if not code.is_valid_int() or int(code) <= previous or int(code) <= 0:
return "Set a positive version code higher than the last recorded build."
return "Practice checks pass. Verify signing, target API and upload eligibility in Play Console."
release_lab.gd
extends VBoxContainer
var body: Label
func start(title_text: String) -> void:
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
offset_left = 34.0
offset_top = 24.0
offset_right = -34.0
offset_bottom = -24.0
add_theme_constant_override("separation", 12)
var title := Label.new()
title.text = title_text
title.add_theme_font_size_override("font_size", 31)
title.add_theme_color_override("font_color", Color("#f5cd85"))
add_child(title)
body = Label.new()
body.custom_minimum_size.y = 138.0
body.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
body.add_theme_font_size_override("font_size", 19)
add_child(body)
var bg := ColorRect.new()
bg.color = Color("#132942")
bg.mouse_filter = Control.MOUSE_FILTER_IGNORE
bg.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
get_parent().add_child(bg)
get_parent().move_child(bg, 0)
func say(message: String) -> void:
body.text = message
func option(label: String, command: Callable) -> void:
var button := Button.new()
button.text = label
button.custom_minimum_size.y = 45.0
button.add_theme_font_size_override("font_size", 19)
button.pressed.connect(command)
add_child(button)
GDScript line by line
Follow the line numbers, including the indent at the start of each line. Find the code the game will run first, then look for the function that reacts when you tap or change something.
Read main.gd line by line
-
extends ControlStarts with Godot's Control type. This script gets the abilities of that type and adds the game's own rules. -
const Lab = preload("res://release_lab.gd")Creates a constant named Lab. The expression prepares a resource at a fixed project path when the script is loaded. -
const TITLE := "Prepare an Android App Bundle"Creates a constant named TITLE. The expression uses the text inside the quotes. Godot infers the type from the first value. -
var ui: VBoxContainerDeclares ui for later use. A colon followed by a type says which kind of value belongs here. -
func _ready() -> void:Godot calls this once after the scene and its children are ready. Use it to set up the room and connect controls. -
ui = VBoxContainer.new()Stores the new value in ui. The expression creates a new VBoxContainer object. -
ui.set_script(Lab)Calls ui.set_script with the values in its parentheses. -
add_child(ui)Adds the new node to the scene tree so that Godot can run and draw it. -
ui.start(TITLE)Calls ui.start with the values in its parentheses. -
build()Calls build with the values in its parentheses. -
func build() -> void:Defines build, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect. -
ui.say("These are practice checks. The full project exports the signed store file.")Calls ui.say with the values in its parentheses. -
ui.option("Check practice APK", show_case.bind("test.apk", "com.example.deck", "6", 5))Calls ui.option with the values in its parentheses. -
ui.option("Check production bundle sample", show_case.bind("harbour.aab", "org.samplecrew.harbour", "6", 5))Calls ui.option with the values in its parentheses. -
ui.option("Check reused version code", show_case.bind("harbour.aab", "org.samplecrew.harbour", "5", 5))Calls ui.option with the values in its parentheses. -
func show_case(file: String, package_id: String, code: String, previous: int) -> void:Defines show case, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect. -
ui.say(validate_bundle(file, package_id, code, previous))Calls ui.say with the values in its parentheses. -
func validate_bundle(filename: String, package_id: String, code: String, previous: int) -> String:Defines validate bundle, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect. -
filename = filename.to_lower()Stores the new value in filename. The expression calls filename.to_lower with the values in its parentheses. -
if not filename.ends_with(".aab"):Checks not filename.ends_with(".aab"). The indented instructions below run only if this test passes. -
return "Use a signed Android App Bundle (.aab) for the store."Finishes the function and hands its result back to the caller. The expression uses the text inside the quotes. -
if package_id.begins_with("com.example.") or package_id.split(".").size() < 3:Checks package_id.begins_with("com.example.") or package_id.split(".").size() < 3. The indented instructions below run only if this test passes. -
return "Replace the example ID with your publisher's unique package ID."Finishes the function and hands its result back to the caller. The expression uses the text inside the quotes. -
if not code.is_valid_int() or int(code) <= previous or int(code) <= 0:Checks not code.is_valid_int() or int(code) <= previous or int(code) <= 0. The indented instructions below run only if this test passes. -
return "Set a positive version code higher than the last recorded build."Finishes the function and hands its result back to the caller. The expression uses the text inside the quotes. -
return "Practice checks pass. Verify signing, target API and upload eligibility in Play Console."Finishes the function and hands its result back to the caller. The expression uses the text inside the quotes.
Read release_lab.gd line by line
-
extends VBoxContainerStarts with Godot's VBoxContainer type. This script gets the abilities of that type and adds the game's own rules. -
var body: LabelDeclares body for later use. A colon followed by a type says which kind of value belongs here. -
func start(title_text: String) -> void:Defines start, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect. -
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)Positions this Control relative to the bounds of its parent. -
offset_left = 34.0Stores the new value in offset_left. The expression reads 34.0. -
offset_top = 24.0Stores the new value in offset_top. The expression reads 24.0. -
offset_right = -34.0Stores the new value in offset_right. The expression reads -34.0. -
offset_bottom = -24.0Stores the new value in offset_bottom. The expression reads -24.0. -
add_theme_constant_override("separation", 12)Calls add_theme_constant_override with the values in its parentheses. -
var title := Label.new()Creates a variable named title. The expression creates a new Label object. Godot infers the type from the first value. -
title.text = title_textUpdates title.text, which controls the words a player sees. The expression reads title_text. -
title.add_theme_font_size_override("font_size", 31)Calls title.add_theme_font_size_override with the values in its parentheses. -
title.add_theme_color_override("font_color", Color("#f5cd85"))Calls title.add_theme_color_override with the values in its parentheses. -
add_child(title)Adds the new node to the scene tree so that Godot can run and draw it. -
body = Label.new()Stores the new value in body. The expression creates a new Label object. -
body.custom_minimum_size.y = 138.0Stores the new value in body.custom_minimum_size.y. The expression reads 138.0. -
body.autowrap_mode = TextServer.AUTOWRAP_WORD_SMARTStores the new value in body.autowrap_mode. The expression reads TextServer.AUTOWRAP_WORD_SMART. -
body.add_theme_font_size_override("font_size", 19)Calls body.add_theme_font_size_override with the values in its parentheses. -
add_child(body)Adds the new node to the scene tree so that Godot can run and draw it. -
var bg := ColorRect.new()Creates a variable named bg. The expression creates a new ColorRect object. Godot infers the type from the first value. -
bg.color = Color("#132942")Stores the new value in bg.color. The expression builds a colour from these values. -
bg.mouse_filter = Control.MOUSE_FILTER_IGNOREUpdates bg.mouse_filter, which controls how this control participates in pointer and touch input. The expression reads Control.MOUSE_FILTER_IGNORE. -
bg.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)Positions this Control relative to the bounds of its parent. -
get_parent().add_child(bg)Calls get_parent with the values in its parentheses. -
get_parent().move_child(bg, 0)Calls get_parent with the values in its parentheses. -
func say(message: String) -> void:Defines say, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect. -
body.text = messageUpdates body.text, which controls the words a player sees. The expression reads message. -
func option(label: String, command: Callable) -> void:Defines option, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect. -
var button := Button.new()Creates a variable named button. The expression creates a new Button object. Godot infers the type from the first value. -
button.text = labelUpdates button.text, which controls the words a player sees. The expression reads label. -
button.custom_minimum_size.y = 45.0Stores the new value in button.custom_minimum_size.y. The expression reads 45.0. -
button.add_theme_font_size_override("font_size", 19)Calls button.add_theme_font_size_override with the values in its parentheses. -
button.pressed.connect(command)Links a signal to the function that should run when the event happens. -
add_child(button)Adds the new node to the scene tree so that Godot can run and draw it.
Find and fix a bug
If Play rejects a reused code, increase the numeric version code while keeping the same package ID for the same app.
Try a change
Ages 10–12. Sort sample filenames for local testing or store delivery. Ages 13–16. Make a ledger that checks the version code against all earlier test codes.