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 Android.mk:
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
include $(BUILD_SHARED_LIBRARY)
source to share
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 Android.mk elsewhere you can do ndk-build APP_BUILD_SCRIPT=path/to/Android.mk
. If you don't want to enter this every time, you can add a file named after jni/Application.mk
you enter APP_BUILD_SCRIPT=path/to/Android.mk
. Also, you have a file named jni/Android.mk
which then includes the real Android.mk
one from which you store it.
source to share