Android Studio + Volley

I am new to Android Studio and I want to use the Volley library for my application, but I cannot add the source as a library in Android Studio.

I searched on the internet but didn’t find anything. Everywhere, as they say, it is imported as a library, but I do not know how to do it.

I got the source of volleyball from the git repository:

https://android.googlesource.com/platform/frameworks/volley 

But now I do not know how to add it to my project as a library.

Thanks for your help in Advance.

+43
android android-studio android-volley gradle static-libraries
Aug 29 '13 at 14:09 on
source share
4 answers

UPDATE: Volley is now officially and available through JCenter. Here's how to import it:

 compile 'com.android.volley:volley:1.0.0' 

DEFERRED WAY:

Late to the party, but was able to import it by adding it to the build.gradle file:

 dependencies { compile 'com.mcxiaoke.volley:library:1.0.19' } 

Here is a link to an unofficial Maven repo

NOTE: Volley v1.0.19 is valid as of 02/05/2016 . Go to Maven Repo (use the link above), find the latest version (line where artifactId = library ) and update the version in your gradle configuration accordingly.

+81
Jul 21 '14 at 18:21
source share

If you do not want to import it as a module, but just use it as a dependency, you can create a jar using ant. In your volley directory just enter ant jar and you will find volley.jar in YOUR_VOLLEY_DIRECTORY / bin (you need to install apache ant if you don't have one)

You can copy the jar to the libs directory in the Android application project (or create the libs directory if you don’t have one) and add a dependency for build.gradle, like this

 compile files('libs/volley.jar') 
+23
Aug 29 '13 at 19:39 on
source share

I know this is a bit later than the other 2 answers, but I could not get the JAR import method to work or export Volley to Gradle, since the latest version keeps errors when creating the version of Gradle was too old ...

What I did was create a new package in my com.android.volley project, and then copy the source code from the Volley package, making sure you have both volley and volley / toolbox. Once I have done this, the application works without problems

I am not very good at GIT, but there should be a way to export only the package to the root of your Gradle Java source

+3
Oct 30 '13 at 15:30
source share

Edit: As stated in the comments, this no longer works.

File → Import Module ...

Select the directory where you downloaded Volley and follow all instructions (you probably won't need to change anything, just click "Next".)

Then start introducing your volleyball material:

 private static RequestQueue queue; 

When you print a RequestQueue, it may cause it to turn off automatically or may turn red after entering it (I don’t remember exactly). If it automatically downloads it, just select it and you're done. If it is red and underlined, press Alt-Enter, and there will be an option for something like “Add from the volley module. Select this and you're done.

(Sorry if this is not all for sure. This is from memory.)

+1
Aug 29 '13 at 14:54
source share



All Articles