I have few questions around using Volley in my projects:

  1. Can this library be used in any Java project or just Android?
  2. I see multiple branches here and no documentation on which branch is to start with. Which branch should I use to start with?
  3. How do you integrate this library in your own project? What approach is better: Make Volley as a standalone library project and spin a jar and put it in your project or copy the all source code inside your project?

$ git clone https://android.googlesource.com/platform/frameworks/volley
$ cd volley
$ android update project -p .
$ ant jar

Then, copy bin/volley.jar into your libs/ folder and off you go!

source


In the Volley lesson, Google instructs as to either add Volley to our project as an Android Library project or as a .jar file.

Here's how to create the Volley .jar file using Android Studio or Eclipse:

NOTE:

In both cases I suggest renaming the .jar file to the date of Volley's latest commit, i.e. volley_20150319.jar, to keep versioning simple.


Android Studio:

  1. Clone the Volley repository via Git.
  2. Import the project into Android Studio. (I usually select the project's gradle file when importing in Android Studio)
  3. Build the project. (I had to change the gradle build settings to reflect the latest build tools and gradle version, but it's usually up to date).
  4. In your file explorer, navigate to [your local path to volley]/build/intermediate/bundles/
  5. In both the debug and release folders you'll find a JAR file called classes.jar.
  6. Copy either JAR file into your libs/ folder.
  7. Gradle sync, and you're done.

Eclipse:

  1. Clone the Volley repository via Git.
  2. Import the project into eclipse.
  3. Right-click the project and select Export...
  4. Select Java / JAR file.
  5. We're only interested in the src folder and nothing else. The easiest way to make sure only it is selected is to deselect the project and then select the src folder inside.
  6. Check the Export generated class files and resources option.
  7. OPTIONAL: If you want the Javadoc to be visible also select the Export Java source files resources.
  8. Create the JAR file and put it in your libs/ folder.

1) Is this library can also be used as networking library in normal Java projects also OR is it strictly for Android Only

It is for Android only, as it depends on Android-specific classes. You can tell this by looking at the source code, for stuff like RequestQueue.

2) I see multiple branches here and no documentation on which branch is to start with. Which branch should I use to start with?

The instructions from the Google I|O presentation were to just clone the git repo, which would pull from the master branch by default.

3) How to integrate this library in your own project? What approach is better: Make Volley as a standalone library project and spin a jar and put it in your project or Copy the all source code inside your project?

The instructions from the Google I|O presentation were to add the source code to your project. Personally, I find this to be a bizarre approach.


you can download the volley.jar

Source : AndroidHive

copy theVolley.jar to libs

Then

Right Click volley.jar -> Add As Library

enter image description here


The Volley library is now published by the Android Open Source Project:

dependencies {
    implementation 'com.android.volley:volley:1.1.0'
}