I have a project in Eclipse which mixes native and Java code using CDT and ADT. It is really simple – demo project, just as in the android-ndk-r7/ samples/hello-jni
My Android.mk (in the /jni folder) is:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -llog
LOCAL_MODULE := hlsdrm
LOCAL_SRC_FILES := hlsdrm.cpp
include $(BUILD_SHARED_LIBRARY)
Everything compiles fine, I can load hlsdrm library by
System.loadLibrary("hlsdrm");
and call the native functions. But where is the library file placed? There is no libhlsdrm.so shared library in any of the project folders. As I could read, it should create a folder “libs” and place the resulting library in it.
Also, when I try to list libraries which is used by the application process by calling:
PackageManager pm = getPackageManager();
String applicationPackage = this.getApplicationInfo().packageName;
ApplicationInfo ai = pm.getApplicationInfo(applicationPackage, PackageManager.GET_SHARED_LIBRARY_FILES);
String[] soFiles = ai.sharedLibraryFiles;
then the soFiles variable is empty…
I have tried to specify the library by uses-library value in the application section of the manifest, but after then Android OS refuses to install that application and shows INSTALL_FAILED_MISSING_SHARED_LIBRARY error.
Can anybody explain me how can I get my shared library – the physical .so file?
Why the sharedLibraryFiles is empty even though the library loads and the native method can be called?
How can I install the application that requires custom shared library?
First of all, you should create libs folder and set up your project.
Refer to following article to do that:
http://maxters.net/2011/02/android-ndk-builder-for-eclipse-in-windows/