0

Let me explain my problem:

I have an api for java, that is used in a sample program for an android device, which includes some functions for different uses with the device, like reading a card inserting it.

The point is that the sample program uses native methods within the jni layer to execute that methods from a .so file, from which I don't have the source code nor a header file.

My question is if I can, somehow, use the functions in the .so file invoking them from android-ndk (without calling a native method from java)

For extra details, I use Android Studio with CMake. If more information is required, feel free to ask and I will update the question. Thanks.

Edit 1:

#add_custom_command(TARGET native-lib POST_BUILD
#    COMMAND ${CMAKE_COMMAND} -E copy
#        ${CMAKE_CURRENT_SOURCE_DIR}/libs/${ANDROID_ABI}/libAndroid.so
#        ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libAndroid.so)
Arnav Borborah
  • 11,357
  • 8
  • 43
  • 88
Seraphid
  • 11
  • 1
  • 1
  • 4
  • Please reference [ndk-cmake](https://developer.android.com/ndk/guides/cmake.html) – Binea xu Sep 08 '17 at 16:49
  • In the sample program it doesn't use cmake or anything similar. In my program, I don't have yet linked the shared object. Anyway, I tried using this command, but it gives an error when building the project. Check edit 1. – Seraphid Sep 08 '17 at 16:55
  • 1
    I believe this [answer](https://stackoverflow.com/a/25088926/192373) may help you. Feel free to ask for more details if something is not clear or missing. – Alex Cohn Sep 09 '17 at 07:03
  • I think that is definitely the way to go. The only problem I have is that my project uses cmake instead of android-mk, but I think I will be able to bypass that. Thank you for your help. – Seraphid Sep 11 '17 at 07:03

0 Answers0