You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Android App Bundles (AABs) are Google’s preferred method of publishing Android apps to the Google Play Store. Starting sometime in 2021, they will be the only way to publish. The best way to build an AAB is to use the Android Gradle Plugin. This project aims to modify the existing “Use Custom Build” process in Godot to create self-contained Gradle projects.
Describe the problem or limitation you are having in your project:
Currently, there is no way for a Godot developer to build an AAB. The Gradle project created by the existing custom build is incomplete: it has no assets, an incomplete resource table, and an incomplete Android Manifest file. This means that a developer cannot use Gradle commands to build their game as an APK or an AAB; they must rely on the editor.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
This proposal changes the Android “Use Custom Build” from building and then updating a template APK to performing the entire build using Gradle. With this change in place it’s possible to add an “Export AAB” checkbox to the UI that will result in Godot exporting an AAB. This change will also open the door to future enhancements, such as Play Asset Delivery support.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
When a user checks “Use Custom Build” in their Android project and then clicks “Export Project”, the Godot engine will now use a different approach to generate a custom build:
The exporting script will first check that the following are true:
a. The res://android directory exists
b. There is a path to the Android SDK
c. The version of Godot matches the version of the custom build template
The exporting script will check to make sure the export path of the apk is valid, and then it will call _update_custom_build_project to overwrite the build.gradle file inside the res://android/build directory
The exporting script will look for the specified icon files for the game, and then it will appropriately resize the icon(s), create res://android/build/res/mipmap folders, and copy the resized icons into those folders. This is what the _copy_icons_to_gradle_project and _resize_launcher_icon functions are for
a. The store_file_in_gradle_project method is used to store files inside the gradle project (in the res://android/build directory)
The exporting script will look through the godot-lib.debug.aar and godot-lib.release.aar to copy all the values.xml files over to res://android/build/res/values directories. While it’s copying files, it will fix the project name by altering the text of these values.xml files. This all happens in the _copy_value_xml_files method.
The exporting script will alter the Android Manifest file. There will be a base Manifest file that will be modified by replacing some placeholder strings. The placeholder strings look like *PLACEHOLDER_VALUE*. The newly generated manifest file is written into the gradle project.
The exporting script goes through all of the assets in the res:// directory that are necessary for the game, and it stores them inside the res://android/build/assets directory of the gradle project. This is done by the already existing export_project_files method, which takes in two function pointers as part of its argument
a. The first function pointer points to rename_and_store_file_in_gradle_project which renames a file and stores it in a gradle project
b. The second function pointer points to store_so_file_in_gradle_project which stores the libgodot_android.so and libc++_shared.so files in the gradle project
After these modifications to the res://android directory, the gradle commands to build the app remain unchanged.
The benefit to this method is that by using this new method, a fully fledged gradle project exists for the developer to use. This is different from the original “Use Custom Build” process because that process did not give the developer a useful gradle project to work with, instead it just provided a base gradle project, and the exporting script would still have to build that apk, unzip it, and insert assets and such to this unzipped apk to create the final game apk.
If this enhancement will not be used often, can it be worked around with a few lines of script?:
This enhancement will end up being used by everyone who publishes a Godot game to the Google Play Store. The Google Play store will stop accepting APKs and only accept Android App Bundles starting some time in 2021. The only way to build Android App Bundles is by modifying the exporting script inside the Godot engine. There are no simple lines of script that can solve this problem, because the current build system does not use Gradle as the primary build tool.
Is there a reason why this should be core and not an add-on in the asset library?:
Being able to export Godot games for Android is a core feature of the Godot editor/engine.
How will this PR be broken down into reasonable, smaller PR’s?
Adding store_file_in_gradle_project, store_so_file_in_gradle_project and rename_and_store_file_in_gradle_project methods. These are all methods related to storing files in the gradle project.
Refactoring of permissions into the _get_permissions method. This refactoring is only related to handling permissions for Android Apps.
Creating the _resize_launcher_icon and _copy_icons_to_gradle_project methods, which are used to copy launcher icons to the gradle project
Adding the _copy_value_xml_files method, which is used to copy the values.xml files into the gradle project.
Adding the _fix_manifest_plaintext method, which is used to fix the Android Manifest file.
Refactoring the gradle_build method, which ties everything else together.
The text was updated successfully, but these errors were encountered:
Describe the project you are working on:
Android App Bundles (AABs) are Google’s preferred method of publishing Android apps to the Google Play Store. Starting sometime in 2021, they will be the only way to publish. The best way to build an AAB is to use the Android Gradle Plugin. This project aims to modify the existing “Use Custom Build” process in Godot to create self-contained Gradle projects.
PR 39761 has the changes
Describe the problem or limitation you are having in your project:
Currently, there is no way for a Godot developer to build an AAB. The Gradle project created by the existing custom build is incomplete: it has no assets, an incomplete resource table, and an incomplete Android Manifest file. This means that a developer cannot use Gradle commands to build their game as an APK or an AAB; they must rely on the editor.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
This proposal changes the Android “Use Custom Build” from building and then updating a template APK to performing the entire build using Gradle. With this change in place it’s possible to add an “Export AAB” checkbox to the UI that will result in Godot exporting an AAB. This change will also open the door to future enhancements, such as Play Asset Delivery support.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
When a user checks “Use Custom Build” in their Android project and then clicks “Export Project”, the Godot engine will now use a different approach to generate a custom build:
The exporting script will first check that the following are true:
a. The
res://android
directory existsb. There is a path to the Android SDK
c. The version of Godot matches the version of the custom build template
The exporting script will check to make sure the export path of the apk is valid, and then it will call
_update_custom_build_project
to overwrite thebuild.gradle
file inside theres://android/build
directoryThe exporting script will look for the specified icon files for the game, and then it will appropriately resize the icon(s), create
res://android/build/res/mipmap
folders, and copy the resized icons into those folders. This is what the_copy_icons_to_gradle_project
and_resize_launcher_icon
functions are fora. The
store_file_in_gradle_project method
is used to store files inside the gradle project (in theres://android/build directory
)The exporting script will look through the
godot-lib.debug.aar
andgodot-lib.release.aar
to copy all thevalues.xml
files over tores://android/build/res/values
directories. While it’s copying files, it will fix the project name by altering the text of thesevalues.xml
files. This all happens in the_copy_value_xml_files
method.The exporting script will alter the Android Manifest file. There will be a base Manifest file that will be modified by replacing some placeholder strings. The placeholder strings look like
*PLACEHOLDER_VALUE*
. The newly generated manifest file is written into the gradle project.The exporting script goes through all of the assets in the
res://
directory that are necessary for the game, and it stores them inside theres://android/build/assets
directory of the gradle project. This is done by the already existingexport_project_files
method, which takes in two function pointers as part of its argumenta. The first function pointer points to
rename_and_store_file_in_gradle_project
which renames a file and stores it in a gradle projectb. The second function pointer points to
store_so_file_in_gradle_project
which stores thelibgodot_android.so
andlibc++_shared.so
files in the gradle projectAfter these modifications to the
res://android
directory, the gradle commands to build the app remain unchanged.The benefit to this method is that by using this new method, a fully fledged gradle project exists for the developer to use. This is different from the original “Use Custom Build” process because that process did not give the developer a useful gradle project to work with, instead it just provided a base gradle project, and the exporting script would still have to build that apk, unzip it, and insert assets and such to this unzipped apk to create the final game apk.
If this enhancement will not be used often, can it be worked around with a few lines of script?:
This enhancement will end up being used by everyone who publishes a Godot game to the Google Play Store. The Google Play store will stop accepting APKs and only accept Android App Bundles starting some time in 2021. The only way to build Android App Bundles is by modifying the exporting script inside the Godot engine. There are no simple lines of script that can solve this problem, because the current build system does not use Gradle as the primary build tool.
Is there a reason why this should be core and not an add-on in the asset library?:
Being able to export Godot games for Android is a core feature of the Godot editor/engine.
How will this PR be broken down into reasonable, smaller PR’s?
Adding
store_file_in_gradle_project
,store_so_file_in_gradle_project
andrename_and_store_file_in_gradle_project
methods. These are all methods related to storing files in the gradle project.Refactoring of permissions into the
_get_permissions
method. This refactoring is only related to handling permissions for Android Apps.Creating the
_resize_launcher_icon
and_copy_icons_to_gradle_project
methods, which are used to copy launcher icons to the gradle projectAdding the
_copy_value_xml_files
method, which is used to copy the values.xml files into the gradle project.Adding the
_fix_manifest_plaintext
method, which is used to fix the Android Manifest file.Refactoring the
gradle_build
method, which ties everything else together.The text was updated successfully, but these errors were encountered: