How do I link against an .so from Android Studio 2.3? - android

I have an .so as well as header files. I would like to use objects and call functions in this .so file from my Android application, but I do not find a good guide or steps to follow to do this. I use Android Studio 2.3.3. Any help will be appreciated. Thanks!

this method is very simple. copy your .so file to project into the jniLibs folder
my project

Related

Android studio create .jar file instead of .aar file

Hi I followed android documentation to create a library. But my problem is whenever I run the project means it is creating .aar file. I google it and found How to convert AAR to JAR
this. I'm using iZip Unarchiver. But it is not extracting the .aar file.
But they accepted that answer. Can any one know how to extract .jar from .aar. Thank you.
You can directly generate jar file using android studio. Here is a good tutorial for this.

JNI folder is not picked up by Android studio after headers are generated

I am working on building an Android Library which is part of a larger Android app project. I am using Android Studio.
I created the Android library as a module in the Android app project. I created my native methods, and then I put the .class through javah -jni and I was able to see the jni folder created and the header file generated.
However, Android Studio is not picking up the jni folder and showing it in the project view.
Anybody have any idea, what am I missing?
After hours of looking through docs, and posts, and tutorials, I remembered to check the simplest of things. Make sure your jni folder is in src/main

How to convert android library project with resources to jar?

Hi I had created an android library project. Now I want to distribute my library to others without showing my code. I tried it with converting to jar. But its not working because I used resources in the library project. So is there any method to convert library project with resources to jar file ?? or How can I hide my java code in the project ??? please help me with some examples, thanks in advance :)
You can convert that library file to jar file by running some commands in command prompt :
jar -cvf jar-file input-file(s)
jar-file is the file name which will be created so it should have extension .jar
For example
jar -cvf convertedjar.jar myppackagename
Please refer this link:
http://docs.oracle.com/javase/tutorial/deployment/jar/build.html
First create a jar from your project and then create a new project and add your resources to that project also put your jar in libs folder of new project. leave the manifest file as it is.
You can see the example in google_play_service_lib which is in extra folder in your sdk.

Referencing .so files from an Android library

I've built OpenSSL into an Android Library that I would like to reference from another Android project.
Unfortunately,
Yes, I do need OpenSSL, as I need to change the behaviour of dependant Android classes not in the public API. (not enough space here)
My experience with native code is non-existant.
The project is selected as a library in Preferences > Android
This library is referenced from a second Android project
My Questions are these
How can I reference the .so files in my Android library from Android.mk in my second project so that I can build dependant files there? I'd prefer not to put the .so files directly in my second project - but if that is the only solution I would accept reasons and directions as an answer.
How should I include/reference the .so file in files I am building in the second project?
Surely, it is something simple.
Thanks in advance.
once you generate (.so) library file, then make a folder in your applitcation's project folder named "libs/armeabi/" put (.so) file in this folder
and in your application write
System.loadLibrary("library_name");

Android OpenCV - no .so files in /lib directories

I have spent days at this point compiling and re-compiling different versions of OpenCV to be used in Android apps.
I don't get any compiler errors, and I'm following all the steps in the tutorials.
But no .so files are getting generated and being placed in the /lib folder
Any ideas?
Do you work with eclipse? Which /lib folder do you mean?
the android/android-opencv/libs folder or
a specific folder from the included samples e.g. android/apps/CVCamera/libs folder?
Did you build OpenCV AND android-opencv AND the specific project without errors? You should check this first.
For a first shot I would suggest you to build a project from the included samples (e.g. the "CVCamera" project). In my folder structure it looked like this:
$cd somepath/OpenCV-2.3.0/android/apps/CVCamera
$sh project_create.sh
$ant compile
If this does not work then follow the error messages or post them here. Perhaps I can help you.
Good luck,
gartenabfall

Categories

Resources