我使用Eclipse for Windows, Android SDK和Android NDK(我确信所有路径都设置正确)。
我正在寻找编译位于jni文件夹中的.c库,但发生了一些错误。这个库依赖于外部的。so库,这些是我的Makefile, Android。Mk和库:jni文件夹。
Android。mk:
LOCAL_PATH := $(call my-dir)
#---------------------------------------------------------------
include $(CLEAR_VARS)
LOCAL_MODULE := pdbeatdetection
LOCAL_C_INCLUDES := $(LOCAL_PATH)C:PROGRAMMINGpd-0.45-4src
LOCAL_CFLAGS := -DPD
LOCAL_SRC_FILES := pdbeatdetection.c
LOCAL_LDLIBS := -L$(LOCAL_PATH)C:PROGRAMMINGPdCorelibsarmeabi -lpdnative
include $(BUILD_SHARED_LIBRARY)
Makefile :
all:
C:PROGRAMMINGandroid-ndk-r10dndk-build.cmd
mkdir ../tmp
cp ..libsarmeabilibpdBeatDetection.so ..tmppdbeatdetection.pd_linux
cd ..tmp && zip externals.zip *.pd_linux && mv externals.zip ..resraw
rm -rf ..tmp
我遵循了一些教程,但我仍然不能解决这个问题。你能给我一些编译库的建议吗,避免出现以下错误
误差:
Description Resource Path Location Type
make.exe: *** [obj/local/armeabi/libpdbeatdetection.so] Error 1 Discoteque C/C++ Problem
谢谢!
如果您的代码依赖于外部。so文件,您应该使用PREBUILT_SHARED_LIBRARY
宏正确地声明它,如下所示:
LOCAL_PATH := $(call my-dir)
#dependency
include $(CLEAR_VARS)
LOCAL_MODULE := pdnative
LOCAL_SRC_FILES := C:/PROGRAMMING/PdCore/libs/$(TARGET_ARCH_ABI)/libpdnative.so
LOCAL_EXPORT_C_INCLUDES := C:/PROGRAMMING/pd-0.45-4/src
include $(PREBUILT_SHARED_LIBRARY)
#your module
include $(CLEAR_VARS)
LOCAL_MODULE := pdbeatdetection
LOCAL_SRC_FILES := pdbeatdetection.c
LOCAL_CFLAGS := -DPD
include $(BUILD_SHARED_LIBRARY)
如果这还不足以解决你的问题,直接调用ndk-build.cmd
给我们报告的错误