0

I have used android - ndk - r8 and followed the LINK to create a .so library. Now my aim is to use this library in another project. Instead of copying the complete source there i just want to use the library. I tried to copy & paste the whole libs/armeabi/libAddition.so library to the project root of the another application but the app crashes when i use these library in other application. The library consists of simple addtion of two number logic.

NOTE Their is no error in application or the .so file and the error in error log is unsatisfiedlinkerror. Also i dont want to create a library project or anything else i just need to use these .so file in my another project.

So what would be the best way to do it? I am using Eclipse.

Shankar Agarwal
  • 34,573
  • 7
  • 66
  • 64
  • Check this answer http://stackoverflow.com/questions/10593987/android-ndk-linking/10615769#10615769 – codetiger May 18 '12 at 03:59
  • The following answers should help solve your question (in combination): http://stackoverflow.com/questions/6165813/using-my-own-prebuilt-shared-library-in-an-android-ndk-project http://stackoverflow.com/questions/10106965/how-to-link-any-libarary-in-ndk-application http://stackoverflow.com/questions/10363021/multiple-my-and-3rd-party-native-libraries-in-android-ndk/10367658 – Samveen May 18 '12 at 20:33

2 Answers2

2

There are two parts to your .so. There is the actual C library you want to use and then there is the JNI glue code. I would bet the reason that your app is crashing is because the JNI is referencing the package name from your previous application. If you want to create a library that you can use over and over you need to create the library and the JNI separately.

CaseyB
  • 24,780
  • 14
  • 77
  • 112
0

This post may be useful. I tried it and it worked for me but only if I called System.loadLibrary from the same package name. Otherwise it thrown an UnsatisfiedLinkError but I didn't looked deeper to know what was wrong.

Community
  • 1
  • 1
Hervé Donner
  • 523
  • 1
  • 6
  • 13