Build android generic collection using ndk-build without jni folder

I can build a shared android library using ndk-build only when all my src is in a jni file, but I would like to build a shared library using ndk-build without the need for a jni folder because my project is not working I have Java -code, so how can I do this?

my simple

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := ctest
LOCAL_SRC_FILES := main.cpp
# for logging
LOCAL_LDLIBS    += -llog
# for native asset manager
LOCAL_LDLIBS    += -landroid




source to share

2 answers

worked like this:

ndk-build APP_BUILD_SCRIPT=path/to/path/to/project/ NDK_PROJECT_PATH=path/to/path/to/project




I would recommend using a subdirectory like that jni

for storing the source in order to keep build products in subdirectories like obj

, libs

and bin

more clearly separated.

But if you have elsewhere you can do ndk-build APP_BUILD_SCRIPT=path/to/

. If you don't want to enter this every time, you can add a file named after jni/

you enter APP_BUILD_SCRIPT=path/to/

. Also, you have a file named jni/

which then includes the real

one from which you store it.



All Articles