Android Library Project JAR from ANT - android

I read in this blog post: http://android-developers.blogspot.nl/2011/10/changes-to-library-projects-in-android.html that I can create a .JAR file for a library project that I could distribute it for external people to leverage.
Where can I find documentation on how I can create this Library Jar?
Does anyone know the steps I need to do via ANT to complete this?

Here is the doc to create lib project...
http://developer.android.com/tools/projects/projects-cmdline.html#SettingUpLibraryProject
and here
http://developer.android.com/tools/projects/index.html#LibraryProjects
check this for additional info
How to specify multiple source directory for Android library project

Related

Looking for JNA Library for Xamarin Android or Xamarin Form Project

one of my xamarin android / xamarin forms project has the dependency
JNA (https://github.com/java-native-access/jna)
I downloaded the jar/aar file and tried converting it to dll so that I can use it in my project but I failed doing so because the JAR file is obfuscated and was giving lot of error while creating a binding library
So my question is, is there any such prebuild library created for the same or nuget available that I can use ?
As far as I know, you can add the .jar file to your project.
Here are the steps below:
Create a new Java Bindings Library project.
Add the .JAR file to the project.
Set the appropriate build action for the .JAR file.
Choose a target framework that the .JAR supports.
Build the Bindings Library.
For more information, you can refer to the Binding a .JAR. This can help you.

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.

Creating jar Library of Android project?

I have a project that uses some resources.I want to create a library from it and publish it.I create a jar file with export option of eclipse,but it did not work.Then I search the we b and it seems that way works if and only if project does not use resources.But I saw this post.Here CommonsWare saya there is a way to create a jar file from a project that uses resources.But that answer has two link that do not open any page on the web and I could not test CommonsWare's answer.So my question is:
Is there any way to create jar library file from project that uses resources?
Note:
I read docs that say:
If you have source code and resources that are common to multiple
Android projects, you can move them to a library project so that it is
easier to maintain across applications and versions.
But as I said before,I want to publish my jar and docs say we can not create jar file from library project.And so I can not publish it.
Here CommonsWare saya there is a way to create a jar file from a project that uses resources.
Not in that answer. You can tell that by actually reading the answer.
But that answer has two link that do not open any page on the web
Sorry, Google reorganized their site and broke the original links. The answer has been updated with current links.
Is there any way to create jar library file from project that uses resources?
No.
You can create an Android library project that includes a JAR instead of Java source code. AFAIK, this recipe still works:
Create an Android library project, with your source code, resources, and such, and get it working
Compile the Java source (e.g., via Ant) and turn it into a JAR file
Create a copy of your original Android library project to serve as a distribution Android library project
Place the compiled JAR from step #2 and put it in libs/ of the distribution library project from step #3.
Delete everything in src/ of the distribution library project (but leave the now-empty src/ directory there)
Distribute the distribution library project (e.g., ZIP it up)
And the new Gradle-based build system supports the AAR package for distributing libraries and such, though I have not played with this yet.

How to distribute an Android Library

I've been spinning a jar for android library project and including this jar in my other apps. But on developer.android.com, I see this statement that I can't distribute a library in a jar:
You cannot export a library project to a JAR file
A library cannot be distributed as a binary file (such as a JAR file).
This will be added in a future version of the SDK Tools.
I really don't understand what does that mean.
It is possible to create an Android library project that does not
include source code. The limitations are:
You still have to ship the resources.
You have to rewrite your code to avoid using R. values, as they
will be wrong. You will have to look up all resource IDs using
getResources().getIdentifier() and/or reflection.
I have the instructions in The Busy Coder's Guide to Advanced Android
Development (http://commonsware.com/AdvAndroid), though the
instructions are new enough that none of my free versions have them.
Quoting some of the instructions from the current edition:
"You can create a binary-only library project via the following steps:
Create an Android library project, with your source code and such –
this is your master project, from which you will create a version of
the library project for distribution.
Compile the Java source (e.g., ant compile) and turn it into a JAR file
Create a distribution Android library project, with the same
resources as the master library project, but no source code
Put the JAR file in the distribution Android library project's libs/
directory
The resulting distribution Android library project will have everything a
main project will need, just without the source code."
Personally, I'd just wait a bit. I am hopeful that the official
support for library-projects-as-JARs will be available soonish.
It means that (at the current time) you must distribute your entire project folder. Rather than just a jar file like you can for java libraries.
When someone wants to use your library they will import your project into eclipse, and then in project properties->android they will add your project as an android library.
A few common ways used to distribute a Library project are by using git, or zipping your project folder and making it available online.

How do I add the JJIL libraries to my Android Eclipse project?

I'm trying to use the JJIL libraries with my Android project:
http://code.google.com/p/jjil/
I followed all the instructions on importing libraries into eclipse on the android guides, and have had no successes. It just fails to import.
Can some one point me in the right direction with this?
Cheers,
Nick D
I recommend you download the source and add it to your project. A lot of compiled .jars won't work in Android because they contain stuff that needs to be converted to the Dalvik format. Just download the source from their google code repository and copy it into the /src folder of your project (with the whole com/whatever/whatever/ directory structure, too). The next time you start Eclipse, the source for those libraries should be in your project and building.

Categories

Resources