+1 vote

I'm trying to build the Android export templates for Godot 2.0.3 on Windows in an MSVC command prompt as per http://docs.godotengine.org/en/latest/reference/compiling_for_android.html because I've modified them to support 'large' screen size. I can build just fine when target=windows but using this command: scons platform=android target=release I get this:

h:\dev\godot\src\godot-2.0.3-stable>scons platform=android target=release
scons: Reading SConscript files ...
No valid target platform selected.
The following were detected:

Please run scons again with argument: platform=<string>
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.

Why isn't it recognizing the target android?

in Engine by (722 points)
edited by

do you have all stuff for android (SDK, NDK, JDK, Gradle)?

If I can build the Godot source does this mean I should be able to build the export templates?

edit: I'll double check

Ok so I had everything installed but was missing a couple of environment variables which I now have. It now detects the android platform but I'm still having an issue. I'm not sure which file it can't find. Any ideas?

h:\dev\godot\src\godot-2.0.3-stable>scons platform=android
scons: Reading SConscript files ...
Godot Android!!!!! (armv7) (with neon)
scons: done reading SConscript files.
scons: Building targets ...
h:\Documents\Android\ndk\android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt//windows-x86_64/bin/arm-linux-androideabi-g++ -o platform\android\os_android.os -c -DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED -mfpu=neon -D__ARM_NEON__ -D_DEBUG -g1 -Wall -O0 -DDEBUG_ENABLED -fno-exceptions -DNO_SAFE_CAST -DDEBUG_MEMORY_ALLOC -DSCI_NAMESPACE -DDEBUG_MEMORY_ALLOC -DANDROID_ENABLED -DUNIX_ENABLED -DNO_FCNTL -DMPC_FIXED_POINT -DMUSEPACK_ENABLED -DSQUISH_ENABLED -DVORBIS_ENABLED -DOPUS_ENABLED -DTHEORA_ENABLED -DTHEORALIB_ENABLED -DPNG_ENABLED -DDDS_ENABLED -DPVR_ENABLED -DJPG_ENABLED -DWEBP_ENABLED -DSPEEX_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -DETC1_ENABLED -DPNG_ARM_NEON_OPT=0 -Icore -Icore\math -Itools -Idrivers -I. -Iplatform\android -IH:\Documents\Android\ndk\android-ndk-r10e\platforms\android-15\arch-arm\usr\include -IH:\Documents\Android\ndk\android-ndk-r10e\sources\cxx-stl\gnu-libstdc++\4.9\include -IH:\Documents\Android\ndk\android-ndk-r10e\sources\cpufeatures -Iplatform\android\vorbis platform\android\os_android.cpp
scons: *** [platform\android\os_android.os] The system cannot find the file specified
scons: building terminated because of errors.

try it again with cmd as administration.

I was running the cmd prompt from visual studio, but anyway I tried running VS as admin and it's still the same.. hmm

A lot of text here, trying to be thorough..

So checking off the requirements:

For compiling under Windows, Linux or OSX, the following is required:

• Python 2.7+ (3.0 is untested as of now).

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

• SCons build system.

scons: Reading SConscript files ...
No valid target platform selected.
The following were detected:

• Android SDK version 19 [Note: Please install all Tools and Extras of sdk manager]
• Android build tools version 19.1

The SDK Manager says I have SDK Tools 26.1.6, SDK Platform-tools 23.1 and SDK Build-tools 19.1 (and others). Is that ok?

• Android NDK

I have r10e installed (see path below). I also set ANDROID_HOME

• Gradle

Well, I installed it and set GRADLE_HOME. Then I did the 12.5.6 Building the APK command, gradlew.bat buid. After downloading a lot of stuff (including another version of Gradle?) I got this

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'java'.
> failed to find target android-19 : H:\Android

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


Total time: 3 mins 16.54 secs


EDIT: Update to the above--I got success with this step after I found ANDROID_HOME was incorrect. But other steps still fail

• OpenJDK 6 or later (or Oracle JDK 6 or later)
java -version reports:

java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

env vars:

Set the environment variable ANDROID_HOME to point to the Android SDK.


Set the environment variable ANDROID_NDK_ROOT to point to the Android NDK.

ANDROID_NDK _ROOT=h:\Documents\Android\ndk\android-ndk-r10e

1 Answer

0 votes

Ok so answering my own question, but still with a question.

The main answer is that I had ANDROID_ HOME incorrect and also I didn't have ANDROID_ NDK_ ROOT (I had ANDROID_ NDK_PATH) instead.

So that's the reason it didn't detect the Android platform.

But continuing on, I still couldn't build the Android export templates. Long story short, the path H:\Android\ndk\android-ndk-r10e\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64 couldn't be found and so the main compile command failed. Instead of windows-x86_64 I had just windows and no others. (Why is it referring to a linux folder??) Anyway as a test, I renamed windows to windows-x86_64 and then the build 'worked' ok, i.e.

scons platform=android target=release

started doing lots of compiling. Of course this is a hack and worries me of the implications. I'd like to know why I didn't have that folder, and whether my 'fix' will actually produce correct results. Thanks.

by (722 points)
edited by

I checked my directories, and I found android-ndk-r10e\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64.
maybe you downloaded ndk 32bit.

Yes I think that's it. Maybe it defaulted to 64 bit because I have Java 64 bit.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.