Import Android volley to Android Studio

前端 未结 17 2158
孤街浪徒
孤街浪徒 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条回答
  • 2020-12-07 12:22

    Updating Warpzit's answer for Android Studio 1.3.2 (differences in bold)
    (update: appears to be the same for Android 2.0)

    1. First get latest volley with git.
    2. In your current project (android studio) click [file] --> [New]--> [New Module].
    3. Now select [Import Gradle Project], Click Next
    4. Now select the directory where you downloaded Volley to.
    5. Now Android studio might guide you to do the rest but continue guide to verify that everything works correct
    6. Open settings.gradle (find in root) and add (or verify this is included):

      include ':app', ':volley'

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

      compile project(":volley")

    0 讨论(0)
  • 2020-12-07 12:24

    The "compile project(':volley')" line was giving me this error:

    Error:Execution failed for task ':volley:processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt

    It was caused because the compileSdk and buildTools versions of module volley were currently on"22" and "22.0.1" and I my project was working with newer ones ("24" and "24.0.1").

    SOLUTION:

    Open your build.gradle (Module:volley) file and change the version of "compileSdk" and "buildTools", for example I changed this:

    android {
        compileSdkVersion 22
        buildToolsVersion = '22.0.1'
    }
    

    for this:

    android {
        compileSdkVersion 24
        buildToolsVersion = '24.0.1'
    }
    

    You should no longer have this error, I hope it helps:)

    0 讨论(0)
  • 2020-12-07 12:25

    add volly to your studio gradle app by compile 'com.android.volley:volley:1.0.0'

    0 讨论(0)
  • 2020-12-07 12:26

    Add this line to the dependencies in build.gradle:

    compile 'com.mcxiaoke.volley:library:1.0.+'
    
    0 讨论(0)
  • 2020-12-07 12:26

    To add volley as submodule and getting regular updates from the GIT repo the following steps can be followed. Main advantage is, Volley can be customised and source code could be pull from GIT repo whenever update is required.

    It is also helping for debugging purpose.

    Follow the below steps :

    Step I :

    Add volley as submodule in Android application project GIT Repo. git submodule add -b master https://android.googlesource.com/platform/frameworks/volley Libraries/Volley

    Step II :

    In settings.gradle, add the following to add volley as a studio project module. include ':Volley' project(':Volley').projectDir=new File('../Libraries/Volley')

    Step III :

    In app/build.gradle, add following line to compile Volley compile project(':Volley')

    That would be all! Volley has been successfully added in the project.

    Every time you want to get the latest code from Google official Volley's repo, just run the below command

    git submodule foreach git pull
    

    For more detailed information : https://gitsubmoduleasandroidtudiomodule.blogspot.in/

    GIT Repo sample code : https://github.com/arpitratan/AndroidGitSubmoduleAsModule

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