我打算将静态 Linux .a 库使用到 android 中。我使用以下链接创建了静态 .a 文件http://codingfreak.blogspot.in/2010/01/creating-and-using-static-libraries-in.html
我的 Android 应用程序中有以下 Android.mk 文件。
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:= first-prebuilt
LOCAL_SRC_FILES:= libarith.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := test-main
LOCAL_STATIC_LIBRARIES := first-prebuilt
LOCAL_SRC_FILES := native.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
include $(BUILD_SHARED_LIBRARY)
当我使用 ndk-build r7b 构建应用程序时,它会出现以下错误。
Сompile++ thumb : test-main <= native.cpp
SharedLibrary : libtest-main.so
/home/hiren/NDK-r7b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: /home/hiren/workspace/VideoTEST/obj/local/armeabi/libarith.a(addition.o): Relocations in generic ELF (EM: 3)
/home/hiren/workspace/VideoTEST/obj/local/armeabi/libarith.a: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [/home/hiren/workspace/VideoTEST/obj/local/armeabi/libtest-main.so] Error 1
任何人都可以帮忙,我被困了很长时间,在这里......提前谢谢。