How can I connect to jnigraphics in Android 2.1?

I have an application that uses jnigraphics, but I need it to be available for Android 2.1 (since users still have up to 25%.) I'm trying to connect it, but with difficulties with binding.

My Android.mk looks like this:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := jnigraphics-prebuilt
LOCAL_SRC_FILES := lib/libjnigraphics.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include

include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE    := yyy
LOCAL_SRC_FILES := yyy.c
LOCAL_SHARED_LIBRARY := jnigraphics-prebuilt
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_LDLIBS    += -lm -llog
#LOCAL_CFLAGS    += -O3

include $(BUILD_SHARED_LIBRARY)

Now it recognizes #include <android/bitmap.h>(I received an error about this before adding the C_INCLUDES lines), but it does not seem to link the library, because when I build it I get undefined references to characters that are in the (apparently) successfully included header file:

Prebuilt       : libjnigraphics.so <= jni/lib/
Install        : libjnigraphics.so => libs/armeabi/libjnigraphics.so
Compile thumb  : yyy <= yyy.c
SharedLibrary  : libyyy.so
/home/xxx/w/zzz/obj/local/armeabi/objs/yyy/yyy.o: In function `Java_yyy_yyy_yyy_MainActivity_yyy':
/home/xxx/w/zzz/jni/yyy.c:143: undefined reference to `AndroidBitmap_getInfo'

Update:

The solution is to provide both the directory containing the library in LDLIBS -L and the name of the library in LDLIBS-l, for example:

LOCAL_LDLIBS += -L$(PROJECT_PATH)/libs/$(TARGET_ARCH_ABI)/ -ljnigraphics -lm -llog

, , :

public native static byte[] doYYY(Bitmap bitmap); static {
    System.loadLibrary("jnigraphics");
    System.loadLibrary("yyy");
}

.

2:

, ( , CY) API, .

+2

All Articles