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

后端 未结 4 1062
广开言路
广开言路 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: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<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')
    

提交回复
热议问题