I have an android project built in eclipse environment with the Android SDK , now I want to add a prebuilt library (.so) to this project , should i use NDK to do that?
Asked
Active
Viewed 445 times
1
-
1yes and i got this error message **java.lang.UnsatisfiedLinkError:..** – ro0xandr Jul 16 '14 at 12:35
-
now, how did you tried to load it? Where did you put the .so ? – Blackbelt Jul 16 '14 at 12:36
-
create a **armeabi** folder in Libs,and define the native method as a public in my activity class. finaly calling the native method – ro0xandr Jul 16 '14 at 12:39
-
it more or less correct. Did you call `System.loadLibray("nameoflib")` ? – Blackbelt Jul 16 '14 at 12:40
-
yes i did, the same error – ro0xandr Jul 16 '14 at 12:43
-
I guess you will need the ndk. Take a look in http://stackoverflow.com/questions/7927210/how-to-include-prebuilt-shared-libraries-in-apk-with-eclipse – Plinio.Santos Jul 16 '14 at 13:04
2 Answers
2
No, just create a jniLibs
folder on the same level of your res
and java
folders, and put the .so files in that.

Alessandro Roaro
- 4,665
- 6
- 29
- 48
1
you usually don't need to use the NDK to use a native library (.so file) from Java. You only need it if you want to create/recompile a .so file or if the .so files doesn't provide any method implementation to Java.
From where does come your library ? A .jar or a Java class should at least come with it.
In order to use your .so file from Java, you need to know what Java methods it's defining to define the same as native from your Java code, from the same class from the same package name the .so file is made for.

ph0b
- 14,353
- 4
- 43
- 41
-
yes Java methods names are the same as class name and package name, but i solved it by creating a second package in my project has the same name of the original package of the .so lib, little help from **IDA pro** de-compiler to find the original package name :) – ro0xandr Jul 18 '14 at 21:44