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:
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.
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.
Related
I would like to use herumi/mcl library in my Android project. I posted a question on Author's forum and he replied with these two solutions:
1. https://github.com/herumi/bls-eth-go-binary/ provides a static library for Android, which contains mcl functions. You can use them through gomobile .
2. https://github.com/herumi/mcl/tree/master/ffi/java provides JNI of mcl. If you can build libmcljava.so for Android by cross-compile, then you can use mcl such as https://github.com/herumi/mcl/blob/master/ffi/java/MclTest.java.
I think that great solution for me is the second Option, but i absolutely dont know how. I am using Android NDK to call C code to my app, but thats all i know.
I am looking for some fresh tutorial or something like step-by-step, what would help me to use this library in my Android project. I am working on Windows OS.
I'm trying to display a .tiff image in an android app and it looks like .tiffs are not supported. The number one recommendation people have been recommending is to use Tiffonandroid (a google code project). Is there a basic way to incorporate a separate .apk file into an android app? I've tried to find resources online, but have come up dry. If that it more complicated then I'm imagining it being does anyone know of any .tiff converters or view libraries that would also work?
Libraries are not .apk files, they are projects or modules of code for you to use in your project. You can import them into your project and many libraries will give directions on how.
In android I need to create a library file(.Jar file) to distribute it to third party people to integrate that functionality within their android apps.
Bit struggling of deciding what the best approach. Yes I can create an android library project and implement the functionality seperately and test it with my main project, but wonder how to create a .Jar file out of that (I know it works perfect with the .Jar file that automatically creates under the bin filder in library project but don't think its the best practice as it automatically creates and we dont have any control over it).
I serched this thing but didn't get an exact way to do this. But I am pretty much sure its possible as we already have .Jar files available to integrate with android.
If someone can explain the steps that I have to follow to create a .Jar file for android it would be great. I am using Eclipse as the IDE.
In my case I am NOT using any resourses from the library project and just few classes that have public methods in it to call from the main project.
Thanks.
Just started looking into OpenCV for Android. I noticed that I need to install something called OpenCV Manager before I can run the apps that use it.
Is there any way to bundle this manager with my app, so that users won't have to install it separately? It would really help if this was possible.
I haven't written an app that uses OpenCV yet, but I'm just looking ahead.
Many thanks.
You are looking for the static initialization method.
See the documentation here.
Also you can check this thread:
Static Initialization on OpenCV Android
I found this answer to be extremely helpful:
https://stackoverflow.com/a/40018413/6030520
You have to make sure that your OpenCV is fully functional before doing this (in other words, make sure you can build a project without errors, etc.). Also, make sure that in the settings.gradle file, you include this line of code:
include ':openCVLibrary330'
(Whatever is between the single quotes depends on the name of the openCVLibrary folder you imported. i.e. If the folder was named openCVLibrary320, then you'd enter:
include ':openCVLibrary320'
instead. The folder name is dependent on the version of OpenCV you are using.)
I am a beginner on android platform, and I want to build a tracerouting app. So these are my queries:
Is it possible to make such an application in Android? if possible then guide me the way that I follow.
Does Android support low-level programming to capture ICMP packets? or do I need to add some kind of JAR (in java) or some other libraries to support this application?
In Java, there are JPCAP and docjar etc kind of libraries that we can import in our IDE or Eclipse so that Java support for making such kind of API's?
I need valuable suggestions.
It's quite late - but someone might see it.
i found this one and it worked for me:
https://github.com/olivierg13/TraceroutePing
The simplest way I can think of is to just check for the traceroute Linux application, execute it, and parse its output.
Android has full networking support, however, Java doesn't expose an interface to alter the IP header. Hence, manually crafting ICMP packages is out of the question (JPCAP is no help here, since it relies on libpcap, which I suppose you won't find on any vanilla installation).
Another possible solution is to use the NDK and create a small library that handles the low-level number crunching. However, I'm not sure if the NDK would allow you to use setsockopt.
This is working pretty well for me, you may have to filter out the string results.
To add this library, you have to download or clone the git repository and implement the folder "library" just as he does in the other module "app" for it to work properly.