how to setup a prebuilt library in jni for android?

hi, i need to use a prebuilt library in my native code so i am placing the library following the example in ndk/samples/native-activity. Below is the structure. Please some one help me out with this error, dsplink.h can not be found. Thanks in advance :)


I thin Vladimir was on the right track. But don't keep the static lib in the obj folder since that one is delete every run, instead create a jni/modules/precompiled or something and put the stuff there...

what you have is a precompiled static lib. that's what the .a file is. it's meant to add it to a compilation process so that it'll be in the final binary. so what you should have is :

include $(CLEAR_VARS)
LOCAL_MODULE    := dsplink
LOCAL_SRC_FILES  := [path-to-prebuilt-lib]/libdsplink.a
LOCAL_EXPORT_C_INCLUDES := [path-to-dsplink-headers-folder]

and also dont forget to include it for the linker in the project .. so below this section in the main shared lib add this line :


Your C file includes dsplink.h file. If you have it, you should add the full path to this file in LOCAL_C_INCLUDES, e.g.

LOCAL_MODULE     := jnihello

By the way, if dsplink.a file is prebuilt, you will be on the safe side to keep it outside of the libs/ folder, so that make clean does not delete it. You can use something like

LOCAL_LDFLAGS += $(LOCAL_PATH)/prebuilt/dsplink.a

to help the linker find the file. is a prebuilt library which has some functions which are used by buyya_read.c. First generate using ndk-build and keep in jni folder where buyya_read.c is kept in ur project in elcipse.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := math-prebuilt

include $(CLEAR_VARS)
LOCAL_MODULE    := buyya_read
LOCAL_SRC_FILES := buyya_read.c
LOCAL_LDLIBS    := -llog

You see the project directory structure in below image.

You should define prebuilt library dsplink in your before jnihello project:

include $(CLEAR_VARS)
LOCAL_MODULE    := dsplink
LOCAL_SRC_FILES  := [path]/libs/armeabi/
LOCAL_EXPORT_C_INCLUDES := [directory-with-dsplink.h-file]
# jnihello

Need Your Help

Scala Implicit Ordering

scala implicit

Is there a way for me to define the same implicit ordering for two different classes?