我需要在 android ndk中使用minizip和 zlib。
我的 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 zip = unzOpen(file);”行 有用
你能帮助我吗?:D
谢谢!