Best way to incorporate Volley (or other library) into Android Studio project

前端 未结 8 802
被撕碎了的回忆
被撕碎了的回忆 2020-11-30 17:55

I\'ve seen different advice on the best way to do this This question covers creating a jar. Elsewhere, I\'ve seen advice to simply copy the volley source into your own proje

相关标签:
8条回答
  • 2020-11-30 18:55

    UPDATE:

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

    OLD ANSWER: You need the next in your build.gradle of your app module:

    dependencies {
            compile 'com.mcxiaoke.volley:library:1.0.19'
            (Rest of your dependencies)
    
        }
    

    This is not the official repo but is a highly trusted one.

    0 讨论(0)
  • 2020-11-30 18:57

    As pointed out by others as well, Volley is officially available on Github:

    Add this line to your gradle dependencies for volley:

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


    To install volley from source read below:

    I like to keep the official volley repository in my app. That way I get it from the official source and can get updates without depending on anyone else and mitigating concerns expressed by other people.

    Added volley as a submodule alongside app.

    git submodule add -b master https://github.com/google/volley.git volley
    

    In my settings.gradle, added the following line to add volley as a module.

    include ':volley'
    

    In my app/build.gradle, I added a compile dependency for the volley project

    compile project(':volley')
    

    That's all! Volley can now be used in my project.

    Everytime I want to sync the volley module with Google's repo, i run this.

    git submodule foreach git pull
    
    0 讨论(0)
提交回复
热议问题