How to implement herumi/mcl library into my Android project? - android

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.

Related

How to use .so lib in an Android application

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.

Using AndroidAsync in my project

I'm following a tutorial where they want me to use android websockets library, unfortunately this library is deprecated and I should now use AndroidAsync.
This should be an easy task for the common Android Developer, but I'm kinda new to Android Development so I would like some help doing this.
I have posted my code as a pastebin because the code is too big to post here.
My code:
http://pastebin.com/dYNAG6eX
The library is already imported into the project, I just need some help changing the code to the correct things.

Android studio c++ ndk support

One of my friends suggested to use c++ support in Android studio in order to hide passwords. I have found tons of tutorials how to get started with ndk in android. But they are all outdated(2015) and everytime I try to use c++ in any way, Android studio crashes. Is there any way to do it in a simpler way now?
P.S./ I want to get rid of experimental plugin that every one uses.
Little off the question, storing passwords in the native layer does not ensure complete safety. A good hacker can get that as well. It is just that you add another additional layer so one has to dig deeper

Are there Android compatible alternatives to Property Utils?

Is there a handy-dandy equivalent to org.apache.commons.beanutils.PropertyUtils on Android?
I can't seem to use bean utils in my android app due to some dependencies on PropertyDescriptor,and IndexedPropertyDescriptor. So I'm wondering if there are any alternatives?
Basically all I want to do is use a method name as a string "someMethod" and feed that into setMethod(anObject, "someMethod", value), much like PropertyUtils does; but without having to resort to the nasties of reflection...
Or are my hands tied and I need to use Reflection?
There is bridge library which works on Android: android-java-air-bridge.jar. Just include into project path and use all apache beanutils features in your Android project as you could use in ordinary java application. Moreover, there are lot of other classes which moved to this Android supporting library. Look at the list.
There is a possibilty to use libraries or write own code depending on the PropertyUtils. But it sure isn't dandy. You can get the general idea about what has to be done in this thread.
There are apparently some projects who have successfully solved the issue, so you can study thier solution. Take a look at Drawingpad-base and libgdx. You can find PropertyUtils in the package com.madrobot.beans in the first project and com.badlogic.gdx.beans in the second.

Traceroute on android

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.

Categories

Resources