godot
godot copied to clipboard
Unable to perform a headless Android build (with custom builds) without first opening the GUI
Godot version: 3.2.1+
OS/device including version: Android
Issue description: The headless version of godot can be used to export projects without opening the editor. This is important for Continuous Delivery & automation of development. Since Godot 3.2.1, we have been able to use a custom android export when exporting our Android games. In a newly checked out project, one has to go to the Project>"Install Android Build Template" in order to begin exporting for android. However, there is no way to do this with the headless version of godot. Because of this, you are unable to perform an initial build of a godot Android game with the headless version, without first opening it in the GUI.
I think there should be a godot command to run this gradle setup from the command line, to keep this tool consistent.
Can't the build template be downloaded and extracted using curl and unzip? The URL may be nontrivial to figure out though.
See also #35600.
I don't think this is the same thing, even though the names are confusingly similar. The build template I'm referring to is the 'build' directory in the 'android' subdirectory. More information here.
While I agree it would be nice with a command line way of doing the "install Android build template", the only thing it does AFAIK is unzipping android_source.zip into the android/build folder.
I guess that's a reasonable alternative for any automated system to implement. Thanks for the help, @Myran . For future people with the same problem: The android_source.zip is inside the export templates.
This is now an issue again in Godot 3.2.2, because extra files are needed to perform a build successfully (from what I can tell, it needs a "plugins" directory and a .build_version file containing the godot version string). Whilst I can add this manually to a build tool it does demonstrate the need for a command line option, as these requirements could change in the future and break the tools which have worked around this issue.
I believe this should be classed as a bug as you are meant to be able to compile using the headless version of godot, and this doesn't allow you to do that.
I.e. godot --export Android fails for a valid project which can be build using the GUI.
@kjav Thanks for the feedback! At the moment, there are no plans to alter the structure of a custom Android build, so the changes to your build tool should be good for a while.
But I do see your point, and agree it would be a good idea to automate that process from the command line. I can't give a firm timeline on when this will be implemented, but contributions are welcomed!
Hey, I wanted to tackle this as my first godot contribution and narrowed down all the locations in need for a change to implement the requested feature. Before I raise an PR I wanted to make sure, that my solution would actually implement the enhancement. One open question beforehand: Should I implement this feature on the master branch or the 3.4 branch, since this issue is assigned to the 3.5 milestone?
Current behavior
Executing godot --path /path/to/project --export-debug "Android" fails, if the project was not opened in editor on the build machine and "Project -> Install Android Build Template..." was not clicked.
This menu button creates the directoy "res://android" with the following contents:
- "/build" directory, in which the "android_source.zip" gets extracted into
- "/plugins" directory, which is empty without further configuration
- and ".build_version" file, which contains the godot version (f.e. "3.5.rc")
Desired behavior
The commands currently executed by clicking the menu button "Project -> Install Android Build Template..." should be available as command line argument.
Proposed API:
godot --path /path/to/project --export-debug "Android" --install-android-build-template [/path/to/android_source.zip]
Where the path to "android_source.zip" can be specified optionally but will default to the default location of "Project -> Install Android Build Template...".
Did I miss something? Is there some aspect I didn't consider? Is the proposed API acceptable?
Hey, I wanted to tackle this as my first godot contribution and narrowed down all the locations in need for a change to implement the requested feature. Before I raise an PR I wanted to make sure, that my solution would actually implement the enhancement. One open question beforehand: Should I implement this feature on the master branch or the 3.4 branch, since this issue is assigned to the 3.5 milestone?
Current behavior
Executing
godot --path /path/to/project --export-debug "Android"fails, if the project was not opened in editor on the build machine and "Project -> Install Android Build Template..." was not clicked. This menu button creates the directoy "res://android" with the following contents:
- "/build" directory, in which the "android_source.zip" gets extracted into
- "/plugins" directory, which is empty without further configuration
- and ".build_version" file, which contains the godot version (f.e. "3.5.rc")
Desired behavior
The commands currently executed by clicking the menu button "Project -> Install Android Build Template..." should be available as command line argument. Proposed API:
godot --path /path/to/project --export-debug "Android" --install-android-build-template [/path/to/android_source.zip]Where the path to "android_source.zip" can be specified optionally but will default to the default location of "Project -> Install Android Build Template...".Did I miss something? Is there some aspect I didn't consider? Is the proposed API acceptable?
Hi @AntonioDell , that sounds like a great first contribution to tackle! As someone who has had to work around the issue, I can confirm that that is how I have fixed the issue manually in the past.
Hey @kjav , I created a PR in which I added the --android-template option to the cli. If you have some time, I'd appreciate your feedback on the code change. Does it solve your issue?
As the other issue has been closed as duplicate, I copy-paste here my concern regarding the solution provided (which doesn't seem to work). Can you please help me to resolve the issue?
https://github.com/godotengine/godot/issues/78412#issuecomment-1597749567
The method mentioned in https://github.com/godotengine/godot/issues/35600#issuecomment-898908949 or in your comment above doesn't work.
I created an
androidfolder within my main folder with the content ofandroid_source.zip, I still read the error message:ERROR: Cannot export project with preset "Android" due to configuration errors: Android build template not installed in the project. Install it from the Project menu.Here is the content of the game folder:
$ ls AutoLoad Materials Themes assets icon.png Design Scenes UI default_bus_layout.tres icon.png.import ExternalVisuals Shaders addons default_env.tres project.godot Game SplashScreen android export_presets.cfgAnd here is the content of the
androidfolder:$ ls android AndroidManifest.xml build.gradle gradle.properties libs src assetPacks config.gradle gradlew res assets gradle gradlew.bat settings.gradleDo you have further indications please?
Can you please not close the issue until it is resolved? It will not only benefit myself but also all future users that will encounter this problem and search for an answer (so they won't have to open another issue, again and again).
Has anyone figured out an approach to tackle this (using Godot 4.x)?
Nothing?
@ntngamedev as far as i can tell, the step of unzipping the contents of android_source.zip into android/build/ still functions. @AdrKacz seems to have unzipped into android directly, which may be the problem. Give it a try, it seems to work here.