2

I am working on including a shared object file onto the Android OS image through the NDK project.

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)

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

How can I resolve this?

halfer
  • 19,824
  • 17
  • 99
  • 186
Britto
  • 501
  • 1
  • 9
  • 22

1 Answers1

1

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.

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.

Lawrence D'Oliveiro
  • 2,768
  • 1
  • 15
  • 13