2013-01-24 111 views
4

我需要使用minizip zlib在android ndk。使用minizip與android ndk

我的JNI/MyApp的/ Android.mk文件:

LOCAL_PATH := $(call my-dir) 

include $(CLEAR_VARS) 

LOCAL_MODULE := MyApp 
LOCAL_SRC_FILES := MyApp.cpp 

LOCAL_LDLIBS := -lz 

include $(BUILD_SHARED_LIBRARY) 

我的JNI/Android.mk

LOCAL_PATH := $(call my-dir) 
include $(call all-subdir-makefiles) 

我的JNI/MyApp的/ MyApp.cpp中

#include <zlib.h> 
#include "minizip/unzip.h" #it's in jni/MyApp/minizip/unzip.h 

void unzip(char* file, char* folder) { 
    unzFile zip = unzOpen(file); 
} 

我jni/Application.mk

APP_MODULES  := MyApp 
APP_STL := gnustl_static 

但是,當我編譯:

Gdbserver  : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver 
Gdbsetup  : libs/armeabi/gdb.setup 
SharedLibrary : libMyApp.so 
C:/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: 
Z:/workspace/MyApp/obj/local/armeabi/objs-debug/MyApp/MyApp.o: in function unzip(char*, char*):Z:/workspace/MyApp/jni/MyApp/MyApp.cpp:5: error: undefined reference to 'unzOpen' collect2: ld returned 1 exit status make: *** [Z:/workspace/MyApp/obj/local/armeabi/libMyApp.so] Error 1 

如果刪除行 「unzFile拉鍊= unzOpen(文件);」它的作品

你能幫我嗎? :D

謝謝!

回答

3

哦...

我忘了添加在LOCAL_SRC_FILES的C文件:d