godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.58k stars 21.1k forks source link

Android template build fails with cmake error #46132

Open Bethleem opened 3 years ago

Bethleem commented 3 years ago

Godot version:

Godot_v3.2.3-stable

OS/device including version:

Windows 10

Issue description:

I managed to follow the tutorial in https://docs.godotengine.org/es/stable/development/compiling/compiling_for_android.html. The scons part is all right, both released for armv7 y arm64v8 compiled ok. So, I run .\gradlew generateGodotTemplates from designed folder. It starst to download a handfull of thing, install them, everything ok. But suddenly the process stops and throws this error:

Could not determine the dependencies of task : Godot:lib:mergeReleaseNativeLibs. CMake 3.6.0 was not found in PATH or by cmake.dir property.

Funny thing is gradle installed CMake 3.6.4111459, not 3.6.0.

I´m no expert with gradle. I guess the CMake in use has to be changed, but no clue how to do that. I didn´t install Android Studio, just the command line tools as instructed in the tutorial. NDK is r21e, not r22.

So, how do I do to skip this error?

Thx!

Calinou commented 3 years ago

cc @m4gr3d

m4gr3d commented 3 years ago

@Bethleem The version of cmake you have should work (I have the same version on my machine). What's the path for your cmake install?

Bethleem commented 3 years ago

Path is C:\programas\android-cmdline-tools\cmake\3.6.4111459 I added that dir to windows path just in case, but same error. I also edited platform/android/java/lib/build.gradle in godot source to add in externalNativeBuild the line version "3.6.0+" and now the error change to "CMake 3.6.0 or higher was not found..."

m4gr3d commented 3 years ago

@Bethleem What's your $ANDROID_HOME environment variable set to?

Also, it might be easier to troubleshoot the issue on the Godot Android developers channel :) You can ping me there using the same username.

Bethleem commented 3 years ago

ANDROID_HOME: C:\programas\android-cmdline-tools ANDROID_NDK_HOME: C:\programas\android-ndk-r21e ANDROID_NDK_ROOT: C:\programas\android-ndk-r21e

Bethleem commented 3 years ago

A full capture of the error:

Task :generateGodotTemplates Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead. Checking the license for package CMake 3.6.4111459 in C:\programas\android-cmdline-tools\licenses License for package CMake 3.6.4111459 accepted. Preparing "Install CMake 3.6.4111459 (revision: 3.6.4111459)". "Install CMake 3.6.4111459 (revision: 3.6.4111459)" ready. Installing CMake 3.6.4111459 in C:\programas\android-cmdline-tools\cmake\3.6.4111459 "Install CMake 3.6.4111459 (revision: 3.6.4111459)" complete. "Install CMake 3.6.4111459 (revision: 3.6.4111459)" finished.

Task :generateGodotTemplates FAILED

FAILURE: Build failed with an exception.

BUILD FAILED in 10s 1 actionable task: 1 executed

Bethleem commented 3 years ago

More tests (in platform/android/java/lib/build.gradle from godot source ): Set version "3.5.0+" Output: CMake version '3.5.0' is too low. Use 3.7.0 or higher. Set version "3.7.0+" Output: CMake '3.6.0-rc2' found in PATH could not satisfy requested version '3.7.0' because it was lower. Set version "3.6.0+" Output: CMake '3.6.0' or higher was not found in PATH or by cmake.dir property.

So, it seems to found the installed cmake (I ran it with --version and said 3.6.0-rc2) while searching for 3.7.0+ but for some reason when 3.6.0+ is the active version, it miss completely to work.

m4gr3d commented 3 years ago

@Bethleem Can you try these instructions instead with the latest from the 3.2 branch and see if they work better.

(They are still in draft until 3.2.4 becomes stable).

Bethleem commented 3 years ago

Sadly, same error with new instructions. I even make a clean slate by deleting all sdk, ndk, source of godot and even gradle, triple check the paths and nothing new comes out. And now the cmake installed is 3.10.2 according to what running it with --version says.

Last thing I perhaps will try tomorrow is to set android.ndk as suggested by gradle for bypassing the ANDROID_NDK_HOME path.

Bethleem commented 3 years ago

Solved!

It was not a bug, you can close this issue. It was an human error for me having zero to none experience with the android sdk. I unzziped the cmdline-tools and set that folder as the sdk root. BIG mistake. The sdk needs a specific folder structure. I needed to create an empty first sdk folder and then inside it placed the cmdline-tools folder, being the first folder the sdk_root for the paths. Then it worked. Perhaps a warning about that specific folder structure should be included in the tutorial, so other rookies like me won´t get to run into this silly mistake.

My apologies for the trouble and thank you all! :)