Import Android volley to Android Studio

前端 未结 17 2186
孤街浪徒
孤街浪徒 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:12

    Most of these answers are out of date.

    Google now has an easy way to import it.. We will continue to see a lot of outdated information as they did not create this solution for a good 2-3 years.

    https://bintray.com/android/android-utils/com.android.volley.volley/view

    All you need to do is add to your Build.Gradle the following:

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

    IE

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 25
        buildToolsVersion "24.0.0"
        defaultConfig {
            applicationId "com.example.foobar.ebay"
            minSdkVersion 23
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:25.1.0'
        compile 'com.android.volley:volley:1.0.0'
        testCompile 'junit:junit:4.12'
    }
    

提交回复
热议问题