Adding Volley library to android project in Eclipse Luna - java

I've created an Android project in Eclipse and I would like to add the Volley library to it. Searching on the web, I've tried these approaches:
Copy the .jar into the libs folder and right-click and add it to build-path.
Open the library as an android project, mark it as library and add it as a reference in my android app.
Nothing works. I still cannot access the classes provided by the library by importing the classes like follow: com.android.volley
Someone has a solution for this ?

The Solution:
Try this:
Add volley.jar to the libs folder. Don't add it to the build
path.
In Eclipse go to Project and make sure Build Automatically is selected.
Now in Project, click on Clean:
Project -> select Clean -> select the project.
As Volley doesn't have any resources like styles, layouts etc., its not necessary to reference it as a library project. The above should work, provided all steps are followed.
If this doesn't work ...
Make sure the library has not been added to the build path. If it is, then remove it. Now, try:
Closing and re-opening the project.
Restarting the IDE (last resort).

The build process for Volley has changed to Gradle. If you just want to use the library without building it, you can get the Jar from Maven or scroll down to the instructions to building it yourself lower in this answer.
Maven
An easier way to obtain the Jar file is to download it directly from Maven Central. You can find the latest version with this search:
http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.mcxiaoke.volley%22
At the time of writing the 1.0.19 version can be found here:
http://search.maven.org/remotecontent?filepath=com/mcxiaoke/volley/library/1.0.19/library-1.0.19.jar
Gradle
The new way to do it is to build the project using Gradle.
You can do this by running:
git clone https://android.googlesource.com/platform/frameworks/volley
gradle build
This will create a file in
build\intermediates\bundles\release
Then add this file into your libs folder and add it to your project.

Related

How to get JAR from Maven for Android

How can we get jar files/library files from Maven repo. Maven provides AAR file.
I know using Android Studio is best but I am facing some issues with my system, so for some time I have to use eclipse.
I want to get jar file/library project for this project
https://github.com/dmytrodanylyk/android-process-button/
Please suggest me some solution.
You can download the source from here and export in to your project and if you want you can create jar easily.
The code you're trying to get is an Android library, and requires some resource to work. You need to download the res folder too from here and you need to add it to your project res folder.

How do I add a Github library to my Android Project as a JAR in Eclipse?

I'm trying to add https://github.com/astuetz/PagerSlidingTabStrip to my project. Looking at it, I notice that it has files in res and depends on its own R.java file. When I make it a JAR I continue to get errors because the dependencies aren't all there. I'm not sure how to get this to work.
I keep getting errors like
import android.support cannot be resolved and everything else too. I tried referencing different answers on StackOverflow but none of them yielded a working solution.
The resources won't be packaged into the JAR file. Google is working on a new packaging scheme called AAR which is supported by Android Studio.
In order to use this third-party library in your own project, you should clone it to a local repo. Then you can import it directly into your Eclipse workspace and then add the Eclipse project to the classpath of your app's project.
Download the whole source code from https://github.com/astuetz/PagerSlidingTabStrip by git tool.
On your Eclipse IDE, import the library as exsisting source code at Android option.
Add the library your add before into your project.

How to include cardslib to my Android project?

I want to create a GridView like GooglePlay.
I found this library on Github. I don't exactly know how to include it to my project. I tried to add it in "Build Path", but it doesn't work.
Is it possible to export it as a jar file?
You will have to import library directory as a project in your Eclipse just like #ssantos said in the answer. However you have to do one extra thing to make it work.
All the code is in a sub folder called "java". You have to right click on it and make it as source folder.
For more information you can look at the official guidlines https://github.com/gabrielemariotti/cardslib/blob/master/doc/BUILD.md
It seems you can find the library project here.-
https://github.com/gabrielemariotti/cardslib/tree/master/library/src/main
I'd try importing that as a project in your workspace (and mark it as Android library), and then including it in your project Android libraries (Project properties => Android => Library section)
If you're using Android Studio, just add the following to your build.gradle file.
dependencies {
compile 'com.github.gabrielemariotti.cards:library:1.3.0'
}

Eclipse: updates to referenced library .jar not picked up

I have 2 Java projects in my Eclipse workspace, as follows:
One is a library of code that automatically creates a .jar file whenever it builds.
The other is an application that uses classes in that library, and references the .jar file created by the library project (by right-clicking the app -> Build Path -> Configure Build Path -> Libraries -> Add JARs...)
However, whenever I modify classes in my library project, although I can see that the library .jar gets updated, the app project doesn't pick up the changes unless I remove the library .jar from the app's referenced libraries and re-add it
Am I fundamentally doing something wrong? Is there perhaps a better way to connect an app to a shared library of code? How can I make sure my app will always refer to the latest library code?
Instead of adding it as a JAR dependency you could add it as a project dependency. Right click your project and go to properties. Click on 'Java Build Path' and select the 'Projects' tab. Click 'Add..." and add your library project.
With the latest Eclipse (I'm sure it also worked the same with the ones before), doing a refresh and Clean on your library project then on your application will update the libraries referenced.

why I can use the sources or jar downloaded in my project?

I am trying to use Maven and JDeveloper for a week now and I'm always get stuck with the same problem. I can download and install the extensions and create new Maven projects. When I package or compile them I can see that the sources are being downloaded and added to my local repository but they are not added in my .jar and I cannot use them in my project unless I add them as lib manually in my project.
If I try to add the folder (where the downloaded jars are) as lib folder to project they are only added as jar and I cannot use them.
Is there another way to update my dependencies from JDeveloper? How can I integrate them properly to my project so I can use them? Is there a newer Hands-On maybe solving my problems? What am I doing wrong? Is there a template project to download maybe? I hope I could explain my problem good enough...

Categories