Reputation: 61
I've extracted .so native JNI library from an android app that I've downloaded.
I have the following questions:
If the JNI is compiled for x86, Is it possible (somehow) to call functions in the library from C code on linux?
If the JNI is compiled for x86, is it possible (somehow) to execute functions from the library from linux (not android)?
Is it possible to call functions from the .so from my android app and not only from the original app? Another way to phrase the question: in general is a dependency exist between a specific android app and its JNI library?
Thanks.
Upvotes: 0
Views: 128
Reputation: 30817
Yes, you can transplant JNI libraries to a different environment. You simply start a JVM with a custom class that loads the library. However, there some very important caveats:
It is theoretically possible to do all of this without a running JVM, but you would be reimplementing a large part of a JVM anyway so it is not worth the trouble.
Upvotes: 1