Android-NDK build system (building hello-gl2)

11,940

Solution 1

make sure that APP_ABI and APP_PLATFORM is defined in your Application.mk and your APP_PLATFORM should be higher than android-5... check: gl.h & glext.h not found

for example, in Application.mk define:

APP_ABI := armeabi #armeabi-v7a
APP_STL := stlport_static
APP_PLATFORM := android-8

Solution 2

In my case it was missing the file default.properties with such content:

target=android-5

Put this file into the root project directory. It may help.

Share:
11,940
peoro
Author by

peoro

Apparently, this user has nothing to say.

Updated on June 04, 2022

Comments

  • peoro
    peoro almost 2 years

    I downloaded and installed Android-NDK on my Archlinux, using this package.

    Got no issues building (and running) the sample hello-jni following the guide on this page, but if I try to do the same with hello-gl2 I get some errors; it looks like it cannot find some header files:

    $ ../../ndk-build 
    /usr/bin/make -f /opt/android-ndk/build/core/build-local.mk
    Compile++ thumb  : gl2jni <= gl_code.cpp
    /opt/android-ndk/samples/hello-gl2/jni/gl_code.cpp:22:23: error: GLES2/gl2.h: No such file or directory
    /opt/android-ndk/samples/hello-gl2/jni/gl_code.cpp:23:26: error: GLES2/gl2ext.h: No such file or directory
    --- SNIP ---
    

    GLES2/gl2.h and GLES2/gl2ext.h are however present in $(NDK)/platforms/android-4/arch-arm/usr/include/, and it looks like$(NDK)/build/core/setup-toolchain.mk should set such include path.

    Has anybody encountered the same issue? How can I compile this sample?
    And then, are there other options to easily build Android-NDK applications? This build system seems quite complicated to me, and I'd prefer using cmake to build my applications.

  • peoro
    peoro over 13 years
    I've got installed android-sdk r08-2 and android-ndk r5-1. Do I need to specify which version to use to ndk-buidl?
  • Brandon
    Brandon over 13 years
    Your installs are fine. Adjust the hello-jni project from inside eclipse.
  • peoro
    peoro over 13 years
    hello-jni compiles and runs fine. Problem is with hello-gl2, which doesn't compile when I run ndk-build...
  • Brandon
    Brandon over 13 years
    I understand that. When I had the same problem, all I needed to do was adjust the API level of my project.
  • david.schreiber
    david.schreiber almost 9 years
    Eclipse -> Android Studio migration was missing this. Now NDK builds work! Thanks!