Skip to content

Commit 73091be

Browse files
m4gr3dCalinou
andauthored
Update the Android build documentation (#9669)
Co-authored-by: Hugo Locurcio <[email protected]>
1 parent 8d1bff6 commit 73091be

File tree

3 files changed

+48
-32
lines changed

3 files changed

+48
-32
lines changed

contributing/development/compiling/compiling_for_android.rst

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,11 @@ Setting up the buildsystem
9090
Building the export templates
9191
-----------------------------
9292

93-
Godot needs two export templates for Android: the optimized "release"
94-
template (``android_release.apk``) and the debug template (``android_debug.apk``).
93+
Godot needs three export templates for Android: the optimized "release"
94+
template (``android_release.apk``), the debug template (``android_debug.apk``),
95+
and the Gradle build template (``android_source.zip``).
9596
As Google requires all APKs to include ARMv8 (64-bit) libraries since August 2019,
96-
the commands below build an APK containing both ARMv7 and ARMv8 libraries.
97+
the commands below build templates containing both ARMv7 and ARMv8 libraries.
9798

9899
Compiling the standard export templates is done by calling SCons from the Godot
99100
root directory with the following arguments:
@@ -105,22 +106,32 @@ root directory with the following arguments:
105106
scons platform=android target=template_release arch=arm32
106107
scons platform=android target=template_release arch=arm64 generate_apk=yes
107108

108-
.. note::
109-
110-
If you are changing the list of architectures you're building, remember to add
111-
``generate_apk=yes`` to the *last* architecture you're building, so that an APK
112-
file is generated after the build.
113-
114-
The resulting APK will be located at ``bin/android_release.apk``.
115-
116109
- Debug template (used when exporting with **Debugging Enabled** checked)
117110

118111
::
119112

120113
scons platform=android target=template_debug arch=arm32
121114
scons platform=android target=template_debug arch=arm64 generate_apk=yes
122115

123-
The resulting APK will be located at ``bin/android_debug.apk``.
116+
- (**Optional**) Dev template (used when troubleshooting)
117+
118+
::
119+
120+
scons platform=android target=template_debug arch=arm32 dev_build=yes
121+
scons platform=android target=template_debug arch=arm64 dev_build=yes generate_apk=yes
122+
123+
The resulting templates will be located under the ``bin`` directory:
124+
125+
- ``bin/android_release.apk`` for the release template
126+
- ``bin/android_debug.apk`` for the debug template
127+
- ``bin/android_dev.apk`` for the dev template
128+
- ``bin/android_source.zip`` for the Gradle build template
129+
130+
.. note::
131+
132+
- If you are changing the list of architectures you're building, remember to add ``generate_apk=yes`` to the *last* architecture you're building, so that the template files are generated after the build.
133+
134+
- To include debug symbols in the generated templates, add the ``debug_symbols=yes`` parameter to the SCons command.
124135

125136
.. seealso::
126137

@@ -142,10 +153,10 @@ example, for the release template:
142153
scons platform=android target=template_release arch=x86_32
143154
scons platform=android target=template_release arch=x86_64 generate_apk=yes
144155

145-
This will create a fat binary that works on all platforms.
146-
The final APK size of exported projects will depend on the platforms you choose
156+
This will create template binaries that works on all platforms.
157+
The final binary size of exported projects will depend on the platforms you choose
147158
to support when exporting; in other words, unused platforms will be removed from
148-
the APK.
159+
the binary.
149160

150161
Cleaning the generated export templates
151162
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -164,19 +175,18 @@ You can use the following commands to remove the generated export templates:
164175
Using the export templates
165176
--------------------------
166177

167-
Godot needs release and debug APKs that were compiled against the same
178+
Godot needs release and debug binaries that were compiled against the same
168179
version/commit as the editor. If you are using official binaries
169180
for the editor, make sure to install the matching export templates,
170181
or build your own from the same version.
171182

172-
When exporting your game, Godot opens the APK, changes a few things inside and
173-
adds your files.
183+
When exporting your game, Godot uses the templates as a base, and updates their content as needed.
174184

175185
Installing the templates
176186
~~~~~~~~~~~~~~~~~~~~~~~~
177187

178188
The newly-compiled templates (``android_debug.apk``
179-
and ``android_release.apk``) must be copied to Godot's templates folder
189+
, ``android_release.apk``, and ``android_source.zip``) must be copied to Godot's templates folder
180190
with their respective names. The templates folder can be located in:
181191

182192
- Windows: ``%APPDATA%\Godot\export_templates\<version>\``
@@ -191,7 +201,7 @@ next to your export templates.
191201
.. TODO: Move these paths to a common reference page
192202
193203
However, if you are writing your custom modules or custom C++ code, you
194-
might instead want to configure your APKs as custom export templates
204+
might instead want to configure your template binaries as custom export templates
195205
here:
196206

197207
.. image:: img/andtemplates.png
@@ -214,16 +224,20 @@ root directory with the following arguments:
214224
scons platform=android arch=x86_32 production=yes target=editor
215225
scons platform=android arch=x86_64 production=yes target=editor generate_apk=yes
216226

217-
You can skip certain architectures depending on your target device to speed up
218-
compilation. Remember to add ``generate_apk=yes`` to the *last* architecture
219-
you're building, so that an APK file is generated after the build.
227+
- You can add the ``dev_build=yes`` parameter to generate a dev build of the Godot editor.
220228

221-
The resulting APK will be located at ``bin/android_editor_builds/android_editor-release.apk``.
229+
- You can add the ``debug_symbols=yes`` parameter to include the debug symbols in the generated build.
222230

223-
Removing the Editor templates
224-
-----------------------------
231+
- You can skip certain architectures depending on your target device to speed up compilation.
232+
233+
Remember to add ``generate_apk=yes`` to the *last* architecture you're building, so that binaries are generated after the build.
234+
235+
The resulting binaries will be located under ``bin/android_editor_builds/``.
236+
237+
Removing the Editor binaries
238+
----------------------------
225239

226-
You can use the following commands to remove the generated editor templates:
240+
You can use the following commands to remove the generated editor binaries:
227241

228242
::
229243

@@ -233,8 +247,8 @@ You can use the following commands to remove the generated editor templates:
233247
# On Linux and macOS
234248
./gradlew clean
235249

236-
Installing the Godot editor
237-
---------------------------
250+
Installing the Godot editor APK
251+
-------------------------------
238252

239253
With an Android device with Developer Options enabled, connect the Android device to your computer via its charging cable to a USB/USB-C port.
240254
Open up a Terminal/Command Prompt and run the following commands from the root directory with the following arguments:

tutorials/editor/using_the_android_editor.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ that can be used to work on new or existing projects on Android devices.
99

1010
.. note::
1111

12-
The Android editor is in beta testing stage, while we continue to refine the experience,
12+
The Android editor is in early access, while we continue to refine the experience,
1313
and bring it up to parity with the Desktop version of the editor. See :ref:`doc_using_the_android_editor_limitations` below.
1414

1515
Android devices support
@@ -41,7 +41,6 @@ Here are the known limitations and issues of the Android editor:
4141
- No support for building and exporting an Android APK binary.
4242
As a workaround, you can generate and export a `Godot PCK or ZIP file <https://docs.godotengine.org/en/stable/tutorials/export/exporting_projects.html#pck-versus-zip-pack-file-formats>`__
4343
- No support for building and exporting binaries for other platforms
44-
- Performance and stability issues when using the *Vulkan Mobile* renderer for a project
4544
- UX not optimized for Android phones form-factor
4645
- `Android Go devices <https://developer.android.com/guide/topics/androidgo>`__ lacks
4746
the *All files access* permission required for device read/write access.

tutorials/export/exporting_for_android.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Download the Android SDK
2828

2929
Download and install the Android SDK.
3030

31-
- You can install the Android SDK using `Android Studio Hedgehog (version 2023.1.1) or later <https://developer.android.com/studio/>`__.
31+
- You can install the Android SDK using `Android Studio Iguana (version 2023.2.1) or later <https://developer.android.com/studio/>`__.
3232

3333
- Run it once to complete the SDK setup using these `instructions <https://developer.android.com/studio/intro/update#sdk-manager>`__.
3434
- Ensure that the `required packages <https://developer.android.com/studio/intro/update#required>`__ are installed as well.
@@ -37,6 +37,9 @@ Download and install the Android SDK.
3737
- Android SDK Build-Tools version 34.0.0
3838
- Android SDK Platform 34
3939
- Android SDK Command-line Tools (latest)
40+
41+
- Ensure that the `NDK and CMake are installed and configured <https://developer.android.com/studio/projects/install-ndk>`__.
42+
4043
- CMake version 3.10.2.4988404
4144
- NDK version r23c (23.2.8568313)
4245

0 commit comments

Comments
 (0)