android jni problem with prebuilt shared library

by ashish vijay » Thu, 19 May 2011 02:49:57 GMT


Sponsored Links
 i am new to android. i m developing a android jni application.
i m trying to build shared library(libnkd_1.so)by "ndk-build".
 which is using functions from prebuilt shared library (libndk_2.so).
i dont have source code for libndk_2.so. this libndk_2.so is linux gcc
generated.

my android.mk is

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := ndk_2
NDK_MODULE_PATH := $(LOCAL_PATH)
LOCAL_SRC_FILES := libndk_2.so
include $(PREBUILT_SHARED_LIBRARY)


include $(CLEAR_VARS)
LOCAL_MODULE :=ndk_1
LOCAL_SRC_FILE:=ndk_1.c
LOCAL_SHARED_LIBRARY := ndk_2
include $(BUILD_SHARED_LIBRARY)

when i try to use ndk-build for building shared library it shows the
following error.


#ndk-build
 Install        : libndk_1.so => libs/armeabi/libndk_1.so
 Install        : libndk_2.so => libs/armeabi/libndk_2.so
 /home/ashish/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/
prebuilt/linux-x86/bin/arm-linux-androideabi-           strip:
Unable to recognise the format of the input file `/root/workspace/ndk1/
libs/armeabi/libndk_2.so'
       make: *** [/root/workspace/ndk1/libs/armeabi/libndk_2.so] Error
1

please help me out.
thanks in advance

-- 



Re: android jni problem with prebuilt shared library

by Nikolay Elenkov » Thu, 19 May 2011 09:37:10 GMT


 On Wed, May 18, 2011 at 3:10 PM, ashish vijay



Not the right forum for NDK questions, but in short: you can't link
 to a library built for another platform. You need to build it (or have
it built if you don't have the source) with the NDK.

-- 


Sponsored Links