Pergunta

I am trying to write an JNI file and it includes JNIHelp.h, however I met some error:

jni/JNIMPEG4Writer.cpp:4:21: fatal error: JNIHelp.h: No such file or directory
compilation terminated.

I guess I should add something to the Android.mk file, but I am not sure what should I add. This is my Android.mk file: LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE                    := JNIMPEG4Writer
LOCAL_STATIC_LIBRARIES  := MPEG4Writer
#LOCAL_LDLIBS                    := -llog
LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib –llog
LOCAL_SRC_FILES                 := JNIMPEG4Writer.cpp

include $(BUILD_SHARED_LIBRARY)

Does anyone have any ideas? Thanks!

Foi útil?

Solução

JNIHelp.h is not part of NDK. You inherited some code from the Android platform. You will find other dependencies on non-public modules, most likely libcutils and libutils.

You have three options: build your code as a module of the platform, rewrite the code to only use public headers and libraries, or download parts of the platform, e.g. https://android.googlesource.com/platform/libnativehelper/, and arrange the include paths accordingly.

To satisfy the linker in the latter scenario, you can use adb pull /system/lib to acquire the versions of libnativehelper.so, libcutils.so, and other referenced non-public libraries. Note that ndk-build will complain about linking against these libraries.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top