Godot 3.2 Custom builds for Android gradle error

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Kristian

Hello everyone,

I’ve tried following this official guide in order to create a custom build for my game project, so that I can integrate this Admob plugin (Godot 3.2 now offers the ability to do so without recompiling, so I’m trying).

Everything else (default android build) seems to work, but after following the steps in the guide and enabling an export template with custom build enabled, when I try to export the project it shows a gradle error, quite instantly after I try to export.

The error occurs before the adding of the Admob plugin, on a fresh “install android build template” installation.

This is the error shown:

My setup:

  • latest macOS version
  • Godot 3.2
  • Java OpenJDK 1.8 (brew install)
  • fresh project, 2 days lifetime (started in Godot 3.2)

Possible differences between the guide and my setup:

  • I have installed the Android SDK command line tools in a folder name “.android-sdk” instead of “android-sdk”, so that I don’t see it often using the finder. Is it a problem? I have used this fix in order to have the sdkmanager find the correct Android SDK root path

  • I have jenv installed with brew that manages my installed java versions. Before setting up anything I set the correct java version (1.8) (I have tried both globally then locally). $JAVA_HOME is correctly set, paths in Godot too. Don’t know if it can cause problems.

Please create an issue on GitHub. Note that this may not be a bug in Godot, but rather a documentation issue. (Is JAVA_HOME and ANDROID_HOME being passed correctly to the Godot process?)

Calinou | 2020-03-27 08:28

Thanks for the comment Calinou. I’m not explicitly passing them, but they’re correctly set. If I open up a terminal and type them, they shows correctly. Should I do something specific for passing them to Godot?

Kristian | 2020-03-27 10:05

I’m not explicitly passing them, but they’re correctly set. If I open up a terminal and type them, they shows correctly. Should I do something specific for passing them to Godot?

If they’re set automatically in a terminal, they’ll be passed to Godot if you run it from a terminal, but this may not be the case if you start it from the macOS Finder or Dock. See this Stack Exchange question for more information.

Calinou | 2020-03-27 20:42

I’m using zsh as the default shell on my macos. I have set the variables in the .zshrc file which should be the same as the .bash_profile, but for the zsh shell. I’m not setting the variables each time I run a new terminal, because they should be (and actually are) already available. So there should not be the need to run godot explicitly passing it the variables via command line. Am I missing something?

Your link about setting the variable permanently would address the problem of not getting the variable available each time I run a new terminal but I am actually getting them, as they’re available. The .bash_profile thing should be the same as setting everything up in the .zshrc file.

Don’t know about running godot via terminal or via finder, I think it should not rely on a command line start up in order to have everything functional. Maybe a command line specific setting for Godot could solve the problem but it should find the variables already, without the need to run it from a terminal. Tell me more if I’m not understanding it right.

Kristian | 2020-03-27 22:20

I don’t know if the macOS desktop sources shell variables from zsh (even on macOS 10.15 where it’s now the default).

Calinou | 2020-03-28 16:55

I’ve added this info as a comment on the GitHub issue. Maybe we should wait until that issue is solved, then post here a solution, just for reference, instead of talking in two places about the same thing? I’ve seen that “Calinou” has added tags on the issue on GitHub, so I guess you’re the same person going back and forth in order to solve problems. Thanks a lot, by the way.

Kristian | 2020-03-28 17:01

Indeed, that’s me :slight_smile: You’re welcome.

Calinou | 2020-03-28 17:17