Building san-angeles and hello-gl2 samples from Android NDK

Recently I started playing with the Android NDK. Looking at the included samples, I stumbled upon a native compilation problem (using the latest Android NDK Revision 8b):
compilation failed for hello-gl2 and san-angeles:

Compile++ thumb : gl2jni <= gl_code.cpp
D:/Work/Apps/android-ndk/samples/hello-gl2//jni/gl_code.cpp:22:23: fatal error:
GLES2/gl2.h: No such file or directory
compilation terminated.
make: *** [D:/Work/Apps/android-ndk/samples/hello-gl2//obj/local/armeabi/objs/gl
2jni/gl_code.o] Error 1

Searching around, I found others with the same problem, but no clear solution. However, the problem is quite simple: Google forgot to include the Application.mk file for these samples.

So to fix it, you need to create Application.mk, or copy an existing one from another sample. You will need to set the APP_PLATFORM inside it to the one used by the Java project. Check the AndroidManifest.xml file for each sample (ie. )

Here’s my Application.mk for hello-gl2:

# The ARMv7 is significanly faster due to the use of the hardware FPU
APP_ABI := armeabi armeabi-v7a
APP_PLATFORM := android-5

For san-angeles it’s this:

# The ARMv7 is significanly faster due to the use of the hardware FPU
APP_ABI := armeabi armeabi-v7a
APP_PLATFORM := android-4 

Please note that for OpenGL 1.x, the minimum platform is android-4; for OpenGL 2.x, it’s android-5.

UPDATE: I was testing the OpenGL samples, but it seems others fail as well:
native-audio (set android platform to android-9 – at least)
native-media (set android platform to android-14 – currently maximum included platform in NDK)

UPDATE 2: It seems there’s also an open issue at Google for this:

I updated it with the solution:

Issue 36133: ndk-build.cmd does not work

I hope this helps.

5 thoughts on “Building san-angeles and hello-gl2 samples from Android NDK”

    1. Hello Jim,

      I will add a paid version to Amazon as soon as possible. However I’ve been working on something totally new (a FREE game) for the past few months – with my friends over at Parudi
      Stay tuned for a nice release (1-2 weeks tops).

  1. Thank you for the power schedule App. Is it possible to have a variant which completely turns the power off and then on at a scheduled time?

    Thank you.

    1. Unfortunately that’s not possible on any Android device. Scheduled power off is possible with Power Schedule, but only for Rooted devices.

  2. Very Nice App, Mircea! Congratulations!
    You might charge it!

    Im a software developer in 80´s (assembler and C only) and know when i see a good software.

    Regards,

    Eilor, Internet provider, from Brasil.

    facebook/eilor.a.marigo

    (you can include this text and my name in your marketing if necessary)

Leave a Reply

Your email address will not be published. Required fields are marked *