Skip to content

Commit 665dba8

Browse files
authored
Merge pull request #8391 from Calinou/compiling-for-android-generate-apk
Document `generate_apk=yes` SCons option in Compiling for Android
2 parents 8f784e4 + 14d35fc commit 665dba8

File tree

1 file changed

+16
-31
lines changed

1 file changed

+16
-31
lines changed

contributing/development/compiling/compiling_for_android.rst

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,8 @@ Building the export templates
8383

8484
Godot needs two export templates for Android: the optimized "release"
8585
template (``android_release.apk``) and the debug template (``android_debug.apk``).
86-
As Google will require all APKs to include ARMv8 (64-bit) libraries starting
87-
from August 2019, the commands below will build an APK containing both
88-
ARMv7 and ARMv8 libraries.
86+
As Google requires all APKs to include ARMv8 (64-bit) libraries since August 2019,
87+
the commands below build an APK containing both ARMv7 and ARMv8 libraries.
8988

9089
Compiling the standard export templates is done by calling SCons from the Godot
9190
root directory with the following arguments:
@@ -95,13 +94,13 @@ root directory with the following arguments:
9594
::
9695

9796
scons platform=android target=template_release arch=arm32
98-
scons platform=android target=template_release arch=arm64
99-
cd platform/android/java
100-
# On Windows
101-
.\gradlew generateGodotTemplates
102-
# On Linux and macOS
103-
./gradlew generateGodotTemplates
97+
scons platform=android target=template_release arch=arm64 generate_apk=yes
10498

99+
.. note::
100+
101+
If you are changing the list of architectures you're building, remember to add
102+
``generate_apk=yes`` to the *last* architecture you're building, so that an APK
103+
file is generated after the build.
105104

106105
The resulting APK will be located at ``bin/android_release.apk``.
107106

@@ -110,13 +109,7 @@ The resulting APK will be located at ``bin/android_release.apk``.
110109
::
111110

112111
scons platform=android target=template_debug arch=arm32
113-
scons platform=android target=template_debug arch=arm64
114-
cd platform/android/java
115-
# On Windows
116-
.\gradlew generateGodotTemplates
117-
# On Linux and macOS
118-
./gradlew generateGodotTemplates
119-
112+
scons platform=android target=template_debug arch=arm64 generate_apk=yes
120113

121114
The resulting APK will be located at ``bin/android_debug.apk``.
122115

@@ -128,7 +121,7 @@ The resulting APK will be located at ``bin/android_debug.apk``.
128121
Adding support for x86 devices
129122
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130123

131-
If you also want to include support for x86 and x86-64 devices, run the SCons
124+
If you also want to include support for x86 and x86_64 devices, run the SCons
132125
command a third and fourth time with the ``arch=x86_32``, and
133126
``arch=x86_64`` arguments before building the APK with Gradle. For
134127
example, for the release template:
@@ -138,13 +131,7 @@ example, for the release template:
138131
scons platform=android target=template_release arch=arm32
139132
scons platform=android target=template_release arch=arm64
140133
scons platform=android target=template_release arch=x86_32
141-
scons platform=android target=template_release arch=x86_64
142-
cd platform/android/java
143-
# On Windows
144-
.\gradlew generateGodotTemplates
145-
# On Linux and macOS
146-
./gradlew generateGodotTemplates
147-
134+
scons platform=android target=template_release arch=x86_64 generate_apk=yes
148135

149136
This will create a fat binary that works on all platforms.
150137
The final APK size of exported projects will depend on the platforms you choose
@@ -188,7 +175,7 @@ with their respective names. The templates folder can be located in:
188175
- macOS: ``$HOME/Library/Application Support/Godot/export_templates/<version>/``
189176

190177
``<version>`` is of the form ``major.minor[.patch].status`` using values from
191-
``version.py`` in your Godot source repository (e.g. ``3.0.5.stable`` or ``3.1.dev``).
178+
``version.py`` in your Godot source repository (e.g. ``4.1.3.stable`` or ``4.2.dev``).
192179
You also need to write this same version string to a ``version.txt`` file located
193180
next to your export templates.
194181

@@ -216,13 +203,11 @@ root directory with the following arguments:
216203
scons platform=android arch=arm32 production=yes target=editor
217204
scons platform=android arch=arm64 production=yes target=editor
218205
scons platform=android arch=x86_32 production=yes target=editor
219-
scons platform=android arch=x86_64 production=yes target=editor
220-
cd platform/android/java
221-
# On Windows
222-
.\gradlew generateGodotEditor
223-
# On Linux and macOS
224-
./gradlew generateGodotEditor
206+
scons platform=android arch=x86_64 production=yes target=editor generate_apk=yes
225207

208+
You can skip certain architectures depending on your target device to speed up
209+
compilation. Remember to add ``generate_apk=yes`` to the *last* architecture
210+
you're building, so that an APK file is generated after the build.
226211

227212
The resulting APK will be located at ``bin/android_editor_builds/android_editor-release.apk``.
228213

0 commit comments

Comments
 (0)