flathub / org.godotengine.Godot

Godot engine
https://flathub.org/apps/details/org.godotengine.Godot
38 stars 23 forks source link

Exporting for Android doesn't work #63

Closed reptofrog closed 2 years ago

reptofrog commented 4 years ago

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.Please set the JAVA_HOME variable in your environment to match the location of your Java installation.

reptofrog commented 4 years ago

Setting flatpak's env. value does not fix this. (non-flatpaked version exports fine)


ERROR: JAVA_HOME is set to an invalid directory: /usr/local/java/jdk1.8.0_45

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
Calinou commented 4 years ago

@zappedfish This is because the Flatpak is sandboxed and can't "see" your system-wide /usr directory.

Quoting from #flatpak IRC:

<barthalion> you will need to install java sdk extension into the app and add - --env=JAVA_HOME=/app/jre to finish args
<barthalion> example app: https://github.com/flathub/org.openstreetmap.josm/blob/3d3a0d05e03f42401a4f9b5cbc4c52dc51936961/org.openstreetmap.josm.yaml#L15
<barthalion> assuming that building for android requires regular java

We need to modify the Flatpak so a copy of the JDK is included automatically. It will increase its size significantly, but that's a price to pay to get everything working out of the box.

pawngames commented 3 years ago

Could we have perhaps a field at the export options to configure another jre? I forced usage of the java packed on the android studio directory and it seems to be working. Still, i supose that i could make that one my main JAVA_HOME location.

Calinou commented 3 years ago

Since Godot 3.3, any kind of exporting to Android is now broken again due to upstream changes. I don't have an ETA for fixing this, so I'll add a patch to prevent exporting to Android from a Flatpak build.

5yk071cL3g10n commented 3 years ago

My flatpak copy won't export at all for any format.

Calinou commented 3 years ago

My flatpak copy won't export at all for any format.

Exporting to desktop platforms should work as long as export templates are installed. You won't be able to use rcedit to change the icon of Windows exports though.

kayomn commented 2 years ago

With export to android now being fixed in Godot, are there any plans to action this issue?

As I see it, the extent of the fix requires either packaging a JRE with the Flatpak bundle or listing one as a dependency.

Calinou commented 2 years ago

With export to android now being fixed in Godot, are there any plans to action this issue?

As I see it, the extent of the fix requires either packaging a JRE with the Flatpak bundle or listing one as a dependency.

Pull requests are welcome, but I don't have time to look into fixing this.

kayomn commented 2 years ago

Forked the repo and got the JRE building with it by including it as a Flatpak SDK extension, however having issues exposing the JRE bin to the PATH.

Approaches I've tried include supplying an additional finish-args parameter and doing this for the generated godot.sh script file

        commands:
          - export PATH="/app/jre/bin:$PATH"
          - export APPDATA="$XDG_DATA_HOME"
          - /app/bin/godot-bin "$@"

I've never built a Flatpak prior to this so there's probably something I'm missing here.

geekley commented 2 years ago

@kayomn Not sure if I'm saying something stupid, but did you try something like this?

flatpak override --env='FLATPAK_ENABLE_SDK_EXT=*' org.godotengine.Godot

* enables all SDK extensions, or it could be jdk or something?

kayomn commented 2 years ago
flatpak override --env='FLATPAK_ENABLE_SDK_EXT=*' org.godotengine.Godot

This would likely work for patching existing installs, but I'm currently investigating a fix for the Flatpak in general.

Additionally, by the sounds of this command it does what I have already modified the manifest to do when building the Flatpak, so the issue surrounding the JRE extension not being on the Flatpak's path still stands.