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.
Related
I need to import this library project into my eclipse. While i am trying to use this project it have some error. Can you help me on this. https://github.com/daimajia/AndroidImageSlider
That project is created for use with Gradle for Android. Eclipse does not support that yet. It is also distributed as an AAR, which Eclipse does not support. There are recipes for converting AARs into Eclipse-friendly Android library projects that you can try. Otherwise, you will need to reorganize the project code yourself to support the classic Eclipse-style project structure. Mostly, that will involve moving the contents of library/src/main/ into a regular Eclipse Android library project:
The res/ directory and AndroidManifest.xml file would go in the library project root directory
The java/ directory would be renamed src/ and also go in the library project directory
However, you will have to repeat this process each and every time the library's author updates the library, at least for those updates that you are interested in.
You may wish to see if there is an alternative library that meets your needs but is better packaged for use with Eclipse.
Basically there are some changes to be done to eclipse project before importing it to eclipse like src folder.
The project you posted may contains many error since it have two more android project dependency.
I tired to convert above project with its dependency :
Checkout Complete Source Code
There is one more project lib u need to add LIB
I need to import into my Eclipse project an external library that is given under the project "Library." this: https://github.com/chrisbanes/ActionBar-PullToRefresh
how do I turn the "Library" folder in a file. jar that I can put in my libs folder?
how do I turn the "Library" folder in a file. jar that I can put in my libs folder?
First, that is an Android library project. It depends upon Android resources. It cannot be a JAR.
Second, that is an Android library project set up for use with Gradle and Android Studio. It is not set up for Eclipse users, and the author of the library did not provide Eclipse instructions.
Third, as it says IN REALLY BIG BOLD LETTERS, the project is discontinued.
You will be better served using SwipeRefreshLayout (from the Android Support libraries), or possibly the PullToRefresh-ListView open source project.
You are welcome to reorganize the code from that Gradle project (the "Library" folder you referred to) into an Eclipse project, moving the Java source under src/ and the resources under res/ and try to get it working. However, you will have to use it as an Android library project, not a JAR.
How should external libraries be included into Android projects?
I see this documentation from Google:
http://developer.android.com/tools/support-library/setup.html#libs-with-res
...which says they should be kept outside the source tree for the project, and referenced as dependencies.
The guide for Facebook libraries says the same thing:
https://developers.facebook.com/docs/android/getting-started/facebook-sdk-for-android/
What about when the project is going into source control, and will be worked on by multiple developers? Is it possible to be sure other developers will have the correct versions of libraries if they're not included in source control?
It seems as though it might be better to check in the whole tree of these external libraries under say an "external" folder in the project and then reference them as libraries from there? The above links don't say this is wrong, but is there any reason not to do that?
I could not find anything against this approach, but maybe my search skills are off.
Thanks!
You have basically tree options (referring to git):
Putting the source or binaries into your git repository.
You can create/clone extra repositories and link these as submodule into your main repository.
Use gradle/android-studio to maintain remote binary dependencies.
In my opinion, option 3. is the best. It speeds up build time and reduces the date saved in your internal repository. Referencing most open source projects, googles libraries and even the Facebook API is just a one liner in your build.gradle file.
For internal libraries or anything not uploaded to some maven repository, you can create a local maven repository and link that.
And in the end, you have the option 2. to create a library submodule within git and gradle to handle it efficiently.
If you want to stick to eclipse + ant, try 2. first.
At least ant will work out of the box for building all things.
Setting up eclipse is a bit more difficult but can be done.
Option 1. is easy to implement, but It might get messy at some point.
Copy jar file in android project libs forlder and right click on jar file and click on bulid path-> add to build path.
If you want to add jar file then copy your jar file and put in to libs folder, and if you want to add external library then import your library project go to project properties and select android tab and add external library with add button.
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.
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.