godot: Android CLI build fails due to locate Android SDK

Godot version: 3.1.1 stable

OS/device including version: Linux

Issue description: I cannot figure out how to export a project to android using the CLI

When I run godot -v --export-debug "Android" build/project.apk

I get the following error

ERROR: instance: Class 'EditorSettings' can only be instantiated by editor.
   At: core/class_db.cpp:523.
ERROR: poll: /home/cnidarias/.config/godot/editor_settings-3.tres:3 - Parse Error: Can't create sub resource of type: EditorSettings
   At: scene/resources/resource_format_text.cpp:561.
ERROR: load: Condition ' err != OK ' is true. returned: RES()
   At: core/io/resource_loader.cpp:208.
ERROR: _load: Failed loading resource: /home/cnidarias/.config/godot/editor_settings-3.tres
   At: core/io/resource_loader.cpp:285.
WARNING: create: Could not open config file.
   At: editor/editor_settings.cpp:871.

It then continues adding and such and ends like this

      export: step 103: File: res://server/scripts/DatabaseHandler.gd.remap
        export: step 103: File: res://server/scripts/MainServer.gd.remap
        export: step 103: File: res://assets/icon_192x192.png
        export: step 103: File: res://assets/splashScreen.png
        export: step 103: File: res://project.binary
0 param: --use_depth_32
1 param: --use_immersive
export: end
WARNING: cleanup: ObjectDB Instances still exist!
   At: core/object.cpp:2095.
ERROR: cleanup: There are still MemoryPool allocs in use at exit!
   At: core/pool_vector.cpp:70.

with no output apk being produced.

I am assuming that the reason the APK is not being produced is because the jarsigning cannot happen as the configuration for the jarsigning bin as well as the default keystore are defined in the editor settings that it initially failed to parse.

The result of executing the command is that the original editor_settings-3.tres will be overwritten with a default one

Reproducing is pretty simple just run the command for any project.

Just to point out, when I set the settings for exporting in the GUI I am able to generate the apk, so this is strictly the CLI not working correctly.

It would be really nice if CLI was working though so that we could have automated builds for our game using Docker to compile the apk

Furthermore this might be related #16949 but I don’t think it is the same because I am able to build it for linux without issues

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 23 (13 by maintainers)

Most upvoted comments

I’m facing this bug too.
I noticed that if you change the output file extension to zip, the file will be created successfully. My guess is that in this case jarsigner and apk are not executed.

Something seems to be wrong with config reading when launching godot in CLI-mode. If export/android/adb or export/android/jarsigner specified in ~/.config/godot/editor_settings-3.tres, then I’ve got the same error as @Cnidarias .
After that the config is getting reset to vanilla but the error is keep showing every time the exporter launches. The only way to get rid of it is to delete entire ~/.config/godot directory.

I made a docker container with android-sdk and godot so it’ll be a little easier to reproduce: bemyak/godot-ci:3.1.1, hope this will help.

Well, actually I was wrong, apk file is created and can be successfully installed on device.

Couple of errors is still there

ERROR: bind: Method/Function Failed, returning: ERR_UNAVAILABLE
At: drivers/unix/net_socket_posix.cpp:386.
ERROR: bind: Method/Function Failed, returning: ERR_UNAVAILABLE
At: drivers/unix/net_socket_posix.cpp:386.

at the start of the export and

ERROR: ~List: Condition ' _first != __null ' is true.
At: ./core/self_list.h:112.
ERROR: cleanup: There are still MemoryPool allocs in use at exit!
At: core/pool_vector.cpp:69.

at the end. But they are no longer preventing apk from being generated.

@Calinou unable to confirm at this time. I think closing is appropriate. If I find the issue returns I will re-open at that point in time.

@FeralBytes #35930 implements environment variable overrides for Android keystore information.