I have created an sample project to learn ndk and run it on emulator with armeabi ABI.I have successfully created my .so file which is placed in armeabi-v7a folder inside libs.When i run the project it shows UnsatisfiedLinkage error findLibrary returned null.I explore the myproject.apk file to find whether my .so file is packed inside apk and fount that inside libs but when i explore avd using DDMS perspective i didn't fount that .so file inside data/data/package/libs/
Created an app with jni folder and write basic c file and then create make file and build it as mentioned on developer site then run the android app using sdk I find .so file inside libs folder in apk But after installation i can't find it inside data/data/package/libs/ So I got findLibrary returned null error in System.loadLibrary("libname"); I have also tried System.load(data/data/com.example.learnndk/lib/libndk1.so)
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -llog
LOCAL_MODULE := ndk1
LOCAL_SRC_FILES := native.c
include $(BUILD_SHARED_LIBRARY)
Application.mk
APP_OPTIM := release
APP_PLATFORM := android-8
APP_STL := gnustl_static
APP_CPPFLAGS += -frtti
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -DANDROID
APP_ABI := armeabi-v7a
Please help me to find a solution..
To be precise my lib file in apk didnt get unpack into applications data directory..
What lib name are you using in System.loadLibrary
? For a library called libndk1.so
you should be saying System.loadLibrary("ndk1");
.
That is, no leading lib
prefix nor the .so
file type.