3

I having trouble setting up my Android NDK based project with multiple modules which depend on each other.

What I would like to accomplish:

jni    
  Application.mk
  Android.mk          (includes make files from modules)
  app
    Android.mk        (needs libpng & libzip modules)
    JniModules.cpp
  libpng
    Android.mk
    ...               (more source files)
  libzip
    Android.mk
    ...               (more source files)

The JniModules.cpp file just include headers from libpng and libzip but the compiler can't seem find the libpng/png.h or libzip/zip.h files.

jni/app/JniModules.cpp:2:24: fatal error: libpng/png.h: No such file or directory
compilation terminated.
make: *** [obj/local/armeabi/objs/JniModules/JniModules.o] Error 1

I've put a bare bones project on github: https://github.com/niob/JniModules.

Any pointers to how I should use another module from within a module?

Sander Versluys
  • 72,737
  • 23
  • 84
  • 91

1 Answers1

4

In your jni/app/android.mk, set LOCAL_C_INCLUDES to LOCAL_C_INCLUDES += $(LOCAL_PATH) or to ``LOCAL_C_INCLUDES += $(LOCAL_PATH)/libpng`

Source

Community
  • 1
  • 1
Triclops200
  • 823
  • 5
  • 22
  • I've already fixed it and idd the c_includes was missing! I gladly award you with the bounty for the effort. (you'll have to wait 3 hours though, SO doesn't allow me to give you the bounty yet) Txn – Sander Versluys May 31 '13 at 08:31