I have an android library project, which I want to include to my titanium android module. In the documentation I found no way to reference the library project. For adding a third party library the documentation has a guide to include a .jar file. So I tried to add the .jar file.
The library project also depends on native libraries (.so files) and resources. I experimented a little bit and I got it somehow working, that the ressources and native libraries are included in my .apk. The problem is: at runtime I get a ClassDefNotFoundError.
I tried pretty much everything and I don't know how to get this running.
BTW I'm a newbie, so maybe it is not even possible what I'm trying to do.
Can anyone please help?
This
fixed it. Just modify the script.
Related
I have looked at Use prebuilt JNI library in Android Studio 3.1 and How to use .so in a second project in Android?. The first is trying to get a library file without headers working and the other seems to be focusing on a specific issue with his build (although there's some useful information there). I'm relatively new to app development and especially to native development on android. I've gotten a build with the JNI library and some c++ code working, but that seems to be just for building from source.
It's probably a simple answer, but I haven't been able to find documentation on this specifically in the android developers documentation. I'm interested in understanding the correct (or most conventional) place to put and way to use a precompiled library (module/lib/*.so and module/include/*.h) in an android project. Would I even need to use JNI or the NDK if the library is built with another build tool? Another project I have has a native library source object (*.so) in ./obj/local, ./libs, and in many other folders related to JNI. I'm guessing it would be somewhere in there, but I'd like to know what is conventional.
For some context, I'm trying to work with the essentia library. I have followed the guide on compiling for Android and have a build with the general hierarchy mentioned above (essentia/lib and essentia/include) that seems to be working.
I have to use an external library with '.a' extensión but I do not have any idea how to use it. I am totally lost, I don´t know if I have to import it or not and if I have to imported I don´t know how.
How can I use this library in my project?
When we want to invoke native library in Android apps, we can only use dynamic library, which usually ends with .so extension.
So that means you have to build a dynamic library based on .a file.
I have .so library and it's 'JNICall' class, which is an interface for it. They was wrote not by me. To be honest, I decompiled one apk to get them. So the question - It is possible to use them in my project, and how I can do this?
Try to find proper documentation for your library otherwise it'll be difficult to integrate,
as for including the so file in your project follow this:
How do I import a native library (.so file) into Eclipse?
I've been working for a month with android ndk, so I am quite a newbie. Currently I am trying to integrate some code into a big project and have multiple problems both with NDK and gstreamer. Questions are stupid but I would be very grateful if someone helped me:
1) After I build and compile a project, do I still need all of those Android.mk files? Or can I just add .so libraries using System.loadlibrary("library")?
2) After I build my .so files, do I still need to declare all .a files as build-shared libraries and link them to the .so which needs them?
3) When I add native android support, do I need to create separate libsomename.so or choose the existing?
Maybe someone could also link me to the good article about building?
1)No, if its already compiled all you need is the so and loadLibrary call. However, if you want to update the library with your app its probably a good idea to keep them
2)No, once you have a .so file that's all you need
3)I'm not sure what you're asking there.
I want to build a java library with some useful things I done to Android. Just like my other project: https://github.com/MarkyVasconcelos/Towel
My question is, what is the best way to share a library on Android?
Source codes from a entirely Android project(res, src, Manifest, etc..)?
Only source codes(.java)?
A generated jar with the 'src' folder?
Thanks.
I'd distribute an Android library project. I have several such projects in my various GitHub repositories -- those links are just three of 'em.
Although never done myself I think you have to provide an Android Library Project if your library contains android specific content.