1

I am defining Application.mk APP_STL := stlport_shared

When I run ndk-build which in turn producing file: stlport_shared.so in obj/local/armeabi/ but it is not copying this file to libs/armeabi/ Because of which it doesn't get copied to the device and System.loadLibrary() throws UnsatisfiedLinkError.

Can anyone help?

Nishant Soni
  • 658
  • 1
  • 9
  • 19

4 Answers4

3

It should be mentioned in the Application.mk as: APP_MODULES := stlport_shared.so other_dependent.so

In ordered to be copied to the device.

Nishant Soni
  • 658
  • 1
  • 9
  • 19
  • It should be Without the `.so` prefix, though. – Fabio A. Dec 21 '11 at 14:34
  • Make sure to include your other modules too if you add this directive. However Android Studio seems to still install libstlport_shared.so into the appropriate folders under libs, even without this directive. – Michael Mar 11 '16 at 19:13
0

As Nishant said, you need to use:

APP_STL       := stlport_shared
APP_MODULES   := stlport_shared mymodule ...

APP_STL ensures use of STLport, while APP_MODULES ensures its copied where needed.

Its a bug that stlport_shared is not copied as needed. See Android Issue 21180: APP_STL := stlport_shared doesn't install libstlport_shared.so into libs directory. It should be fixed in NDK R7b.

jww
  • 97,681
  • 90
  • 411
  • 885
0

I believe you need to include something like following in your Android.mk file:

include $(CLEAR_VARS)  
LOCAL_MODULE := stlport_shared  
LOCAL_SRC_FILES := stlport_shared.so  
include $(PREBUILT_SHARED_LIBRARY)  
Christian Specht
  • 35,843
  • 15
  • 128
  • 182
John O'Reilly
  • 10,000
  • 4
  • 41
  • 63
0

I had to add a line to my java file to load it:

System.loadLibrary("stlport_shared");
System.loadLibrary("my_lib");
Tod
  • 4,618
  • 4
  • 32
  • 23