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.
Related
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.
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.
I've created a custom view that extends a RelativeLayout for a project I'm working on. I think it might be useful to others, so I've been trying to set it up as a library so others can find and use it.
I've haven't been able to find a clear answer on how to go about setting this up in Android Studio.
To be clear - I have already built the view and it is working fine, I just want to package it up as a library.
Do I create a new project and simply put my code there, or do I need to make a new module too? Once I do either of those things, which parts of the manifest and gradle files do I need to change?
Lastly, do I need to somehow get an AAR from the files or is it best to just upload it to GitHub and let others clone it?
In Android Studio (v 1.0.2):
File -> New module... -> Android Library
In this new module put all the code you want to share. Android Studio should update Gradle's settings accordingly.
You can publish your library as source code and/or artifacts in some Maven/Gradle repository. Publishing source code allow others to contribute to your work, fixing bugs or extending functionality. However, if you just do that, it won't be very convenient to reuse it for other developers, because working with source requires checkout and build. If you publish also artifacts (in some Maven/Gradle repository) built from that code, you will simplify the life of people using your code :)
I have a project that I have been working on which is a standard android application that does not include any other external libraries at this time. I am now looking at making a game at the end of the app(its a quiz so after the questions I want to make a mini game).
So what I am trying to find out is can I just import the libraries that it uses and connect them to my project rather than creating a LibGDX project and importing that?
What it comes down to is your personal preference. In answer to your question, yes you could just add in the jar files and such into your current project, however you are going to have to edit your manifest and some add in some other stuff besides jars using this Setup. In my personal opinion it would be easier to create a libgdx project using the tutorial found here, but in the end as I said before it all depends on what exactly you want to do.
Before deciding, ask yourself.
Do I want to have everything in one project, or can it be in more than one?
What would be better in the long run for managing my app.
Do I want ease now or later?
Cheers!
So here is the deal. Let's say I'm developing an app depending on the Facebook SDK and Chris Banes PullToRefreshListView. I import the SDK's to my workspace(which I don't really like since it fills upp the workspace!) and reference it in my app as libraries. I'm making some changes to the PullToRefreshListView, let's say I'm adding a custom font or changing the color of one of the labels.
Now, I'm using Git to version control my project. I would like to be able to put up my project to our Git server and make my colleagues able to pull the project and get to work without having to struggle with getting the same SDK's (of the same versions as I used) setup and referenced in the project. Since I've made some changes to one of the libraries, the project could never be fully restored by another person if I don't provide the code.
How should I act in this situation?
Is it possible to put an uncompiled library in the libs folder or something like that?
If not, what is the right way of accomplishing this?
All I can find when Googling or searching Stack Overflow is how-to's on using compiled .jar files in the libs folder, which is good but not what I'm looking for.
Essentially, I'm looking for a good way of structuring projects using 3rd party libraries.
It sounds like these are android library projects (they contain assets). If that's the case, you can't turn them into JAR files.
The easiest way that comes to mind is to have your root project folder contain your app and all said libraries:
Root
-\Your app
-\src
-\res
-\3rd party lib 1
-\3rd party lib 2
-\3rd party lib 3
This structure would make it pretty simple to push to git and manage in eclipse.