How to make a .jar out of the Volley project?
Asked Answered
A

4

21

How do I make a .jar file out of the Volley project (git repository)?

I have tried to follow the instructions in this answer, however running android update project -p . in the cloned volley folder throws this error:

Error: . is not a valid project (AndroidManifest.xml not found).
Appointive answered 15/12, 2014 at 15:54 Comment(0)
S
31

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.

Skater answered 22/12, 2014 at 3:15 Comment(7)
I ended up using another library, so I won't verify the correctness of this answer, but based on the number of upvotes, I assume it is correct, thus accepting. Thank you nevertheless.Appointive
I'm wondering what is the reason for the added step "git checkout 008e0cc8"? What is this doing? Many thanks.Saffren
The reason to add this step is to checkout an old version of the repository before the jar file process was broken. I am updating the answer with an easier way.Skater
Why library-1.0.15.jar size (90.8 KB) is larger than built jar (84.3 KB)?!Cloison
This is not google tho, is it? Also I would like to know if you dont mind @Zabri what library did you use finally?Kwei
Doesn't really answer the question, and potentially using old code. @Sateesh G has the better answerCorned
incase if you guys dunno where is gradle, /Applications/Android Studio.app/Contents/gradle/gradle-2.4/bin/gradle (for mine) also ive to chmod a+x on it before able to useJabalpur
M
1

Before you run the android update project -p . command on command prompt first run this command git checkout 008e0cc8 it would surpress any errors especially the (AndroidManifest.xml not found), then you can now run the android update project -p . it works

Matrimony answered 18/1, 2016 at 15:6 Comment(0)
L
0

They moved the project to gradle. You need to build project using gradle. You can find the detailed explanation how to make volley jar using gradle command here.

Before you build the volley project you may need to set some environmental variable like adding gradle location to PATH or setting ANDROID_HOME.

Lumpish answered 30/6, 2015 at 12:26 Comment(0)
C
0

@Sateesh G answer is the better answer. Here are the steps I used to build volley as an aar on OS X. (Assuming you already have git, gradle, and android dev tools setup and working)

export ANDROID_HOME=~/.android-sdk/android-sdk-macosx
git clone https://android.googlesource.com/platform/frameworks/volley
cd volley

Configured roblectric and its dependencies

echo 'emulateSdk=18'>>src/test/resources/org.robolectric.Config.properties
cat<<END>rules.gradle
allprojects {
    repositories {
        jcenter()
    }
}
dependencies {
    testCompile 'junit:junit:4.12'
    testCompile 'org.apache.maven:maven-ant-tasks:2.1.3'
    testCompile 'org.mockito:mockito-core:1.9.5'
    testCompile 'org.robolectric:robolectric:2.4'
}
END

Build the aar

gradle wrapper
./gradlew clean build

Output files will be located under

build/outputs/aar

Finally to include the resulting aar files in your Android project; copy the volley-release.aar file to the libs subdirectory under your project and add the following to your projects build.gradle file

repositories {
    flatDir {
        dirs 'libs'
    }
}

compile('com.android.volley:volley-release:1.0.0@aar')
Corned answered 11/7, 2015 at 12:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.