Import Android volley to Android Studio

前端 未结 17 2199
孤街浪徒
孤街浪徒 2020-12-07 11:33

I wanna use the google\'s volley library

I am using Android Studio and I know how to add .jar libraries.

But I could not create a .jar library with the voll

17条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-07 12:00

    So Volley has been updated to Android studio build style which makes it harder create a jar. But the recommended way for eclipse was using it as a library project and this goes for android studio as well, but when working in android studio we call this a module. So here is a guide to how do it the way Google wants us to do it. Guide is based on this nice tutorial.

    1. First get latest volley with git (git clone https://android.googlesource.com/platform/frameworks/volley).

    2. In your current project (android studio) click [File] --> [New] -->[Import Module].

    3. Now select the directory where you downloaded Volley to.

    4. Now Android studio might guide you to do the rest but continue guide to verify that everything works correct

    5. Open settings.gradle (find in root) and add (or verify this is included):

      include ':app', ':volley'

    6. Now go to your build.gradle in your project and add the dependency:

      compile project(":volley")

    Thats all there is to it, much simpler and easier than compiling a jar and safer than relying on third parties jars or maven uploads.

提交回复
热议问题