-1

I am working on my master thesis, where I am looking at the security for an IoT device, which is controlled by an android application. At this point, I have reverse engineered the application and looked through the code that came out of it. An interesting discovery is that it is using a .so lib to communicate with the IoT device. So, I would like to build a POC android application where I use this same .so lib.

Now, my question is: how do I do this correctly? From what I have understood so far, I need to put the .so lib into the structure: app/jniLib/armeabi-v7a/*.so

Then I need to load the library in java with:

static { System.loadLibrary("something_lib"); }

Now if I wish to call a function I should do this by using the "native" keyword: enter image description here

But, as shown in the image above, the function is not being found. So, I properly miss something or am doing something completely wrong.

I've looked at a project on GitHub (https://github.com/SandroMachado/openalpr-android), which is also using .so lib. But I'm having the same experience when I open this project.

I have also had a look at the Android NDK guides (https://developer.android.com/ndk/guides/prebuilts.html), but sadly it did not make me a lot smarter. Here it says something about an Android.mk file, is this still something I need in my situation? If so, I would love if something has a link to a page or can explain to me the missing gaps I have in my knowledge about how to do this.

A simple example/guide for how to use a .so file in a project would be the ultimate solution for me at this point.

Silverbaq
  • 172
  • 8

1 Answers1

0

Maybe this thread help you: How to include *.so library in Android Studio? Looks like you should integrate your *.so files into src/main/jniLib/armeabi-v7a/*.so rather than app/jniLib/armeabi-a7/*.so. Verify that your arm-directory is named armeabi-v7a and not armeabi-a7.

M_I
  • 132
  • 5
  • I made a typo in my question, thanks for the notification. I have spelled it correctly in my project. I'll have a look at that thread. Thanks! – Silverbaq Mar 13 '18 at 09:47