New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use precompiled native library in java or kotlin andorid project #855
Comments
the hello-libs example showed steps should work, by default, it uses the pre-generated libs under distribution directory (you can re-generate them if you need to). Might go through README.md first, and make sure your pre-built libs are in the place you configure in your application's build script(CMakeLists.txt), and remember to supply one ABI flavor lib for all you intended ABIs. |
Hi @ggfan, yes the example works but doesn't show exactly how to use a completely external library, the case I'm trying to describe is if the hello_libs library was already precompiled too and just add the .so file to be packaged so can be used in the java project, does that can be done? or there are examples of that? thank you for your help |
The libs under distribution are pre-compiled. The steps are inside the readme.md file. does not matter how the lib is generated, just point them to the application build system (make sure libs are pre-generated for Android. a shared lib for linux, fox example, will not work for Android). |
Yes I know those are precompiled but they are linked to the hello_libs library (and used inside that one) that is going to be build when doing gradle build, I am looking for an example where is just using the precompiled libs in the java project without linking them to one that is being build, like an example were hello_libs is also a prebuild libray and used in the way that already is |
Oh, just put them into the jniLibs/$ABI directories, and remember to load it in your Java / Kotlin file at least once. |
Thanks allot @ggfan, that was the deal, also would be great to have an example like that in the samples |
I have a precompiled native library .so file that uses jni to be used in an android java app.
I have already saw the example hello-libs that uses precompiled libraries, but the library used in the java project is not the precompiled one is one that is built using CMake.
What would be necessary for use the precompiled one in the java project without having to build it again?
To be packaged in the .apk and use it in the java app by using the System.loadLibrary("mylib");
Thank you for your help.
The text was updated successfully, but these errors were encountered: