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

后端 未结 4 1057
广开言路
广开言路 2020-12-15 05:30

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 pr

相关标签:
4条回答
  • 2020-12-15 05:45

    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.

    0 讨论(0)
  • 2020-12-15 05:49

    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

    0 讨论(0)
  • 2020-12-15 05:53

    @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')
    
    0 讨论(0)
  • 2020-12-15 05:58

    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.

    0 讨论(0)
提交回复
热议问题