包括prebuilt共享对象在NDK项目文件 [英] including a prebuilt shared object file in an NDK project
问题描述
喜很努力,包括共享对象文件到Android操作系统映像通过NDK项目。
Hi am working on including a shared object file onto the android OS image through the NDK project.
在android.mk文件看起来像这样
the android.mk file looks like this
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := Myaccessories
LOCAL_SRC_FILES := libMyaccessories.so
include $(PREBUILT_SHARED_LIBRARY)
和我添加了libMyaccessories.so到了android.mk所在的文件夹JNI。
上NDK构建,它会导致误差,其如以下
and i have added the "libMyaccessories.so" to the jni folder where the android.mk is located. On ndk-built, it results in error which is as below
Prebuilt : libMyaccessories.so <= jni/
Install : libMyaccessories.so => libs/armeabi/libMyaccessories.so
/home/Identive/Desktop/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-strip: Unable to recognise the format of the input file `./libs/armeabi/libMyaccessories.so'
make: *** [libs/armeabi/libMyaccessories.so] Error 1
请帮助我,如果任何人所遇到的这个问题,或者建议我用一些其他的方法。
Kindly help me if anyone have come across this problem or suggest me with some other methods.
推荐答案
只要把.so文件在库/ armeabi /子目录,它会自动被纳入作为构建的一部分。别提它LOCAL_SRC_FILES,因为它不是一个源文件。
Just put the .so file in your libs/armeabi/ subdirectory, and it should automatically be included as part of your build. Don’t mention it in LOCAL_SRC_FILES, as it’s not a source file.
如果该库正在从本地code引用,而不仅仅是Java的code,你可能需要列出它LOCAL_LDLIBS,但我会非常惊讶,如果这不是默认的。
If that library is being referenced from native code, not just Java code, you may need to list it in LOCAL_LDLIBS, but I’d be very surprised if this isn’t the default.
这篇关于包括prebuilt共享对象在NDK项目文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!