4

I cloned volley from git clone https://android.googlesource.com/platform/frameworks/volley and imported it as a new module in AndroidStudio, but I get the following error when syncing:

Failed to resolve: com.android.volley:volley.1.0.0

My build.gradle, in my app folder:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.cs169_au.volleytest1"
        minSdkVersion 22
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support:design:23.2.0'
    compile 'com.google.android.gms:play-services:8.1.0'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.google.maps:google-maps-services:0.1.7'
    compile 'com.android.volley:volley.1.0.0'
}

repositories {
    mavenCentral()
}
CCS
  • 101
  • 1
  • 1
  • 9
  • Add Volley Jar file, or else try to add dependency from Project Structure->Dependency-> search for Volley library. – Silvans Solanki Mar 11 '16 at 06:34
  • http://stackoverflow.com/questions/32859819/androidstudio-gradle-sync-failed-to-resolve – IntelliJ Amiya Mar 11 '16 at 06:43
  • There is no need for you to clone the repository and add it as a new module. Once you add the line compile 'com.android.volley:volley.1.0.0', Android studio will do everything for you. It will download the library and integrate it into your project. That is all I did and it worked on the first try. In fact if you integrated the repository into the module and also have the line compile 'com.android.volley:volley.1.0.0', you will get conflicts, so make sure to remove it. – yoram givon Jun 09 '16 at 13:02

9 Answers9

6

Google's official Volley is hosted in JCenter, so you have to add jcenter() to repositories in the project's build.gradle:

allprojects {
    repositories {
        mavenCentral()
        jcenter() // Add this line
    }
}
Franco
  • 2,711
  • 2
  • 20
  • 27
3

Try using this:

compile 'com.mcxiaoke.volley:library:1.0.19'

Rohit Arya
  • 6,751
  • 1
  • 26
  • 40
  • Getting a "Error:Execution failed for task ':volley:processDebugResources'. > aapt is missing" now. – CCS Mar 11 '16 at 06:38
  • Why did you edit this? Please see that the question **is** using the official verison – OneCricketeer Aug 01 '16 at 08:39
  • This answer makes no sense, the person is trying to use the Volley version from the official Google repository, this is just modifying it to get it from somewhere else. – Franco Jul 05 '17 at 04:31
1

Failed to resolve: com.android.volley:volley.1.0.0

Open build.gradle and add volley support compile 'com.mcxiaoke.volley:library-aar:1.0.0' under dependencies section.

Finally

dependencies {
        compile 'com.mcxiaoke.volley:library-aar:1.0.0'//1.0.19
}

Then Clean-Rebuild-Sync Your Project .

Edit

Using SNAPSHOT

add this to repositories section in build.gradle

repositories {
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    }

add this to dependencies section in build.gradle

compile 'com.mcxiaoke.volley:library:1.0.19-SNAPSHOT'

Courtesy goes to

https://github.com/mcxiaoke/android-volley

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
  • So this worked for a second, but cleaning-rebuilding-syncing a second time broke it. I get a "Error:Execution failed for task :volley:processDebugResources'. > aapt is missing" while cleaning. Same thing happens if I rebuild or sync instead. – CCS Mar 11 '16 at 07:07
  • 1
    Ah, the first time it ran on my device without errors but still gave me errors when I cleaned-rebuilt-synced. – CCS Mar 11 '16 at 07:10
  • @CCS add `multiDexEnabled true` in your `defaultConfig` section – IntelliJ Amiya Mar 11 '16 at 07:12
1

Failed to resolve: com.android.volley:volley.1.0.0

in android studio go to File->project structure-> modules->app-> dependencies click icon + in right corner then go to module dependency select Volley. if there is another dependencies name with volley remove that.

Hope it will works for you.

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
Ankur1994a
  • 2,112
  • 2
  • 13
  • 18
1

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

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

Instead of a dot use a colon.

Adonis
  • 4,670
  • 3
  • 37
  • 57
Purva
  • 11
  • 1
1

I also suffered with the same problem and finally resolved the following way

we should specify the maven urls in the project level "build.gradle" file. Then it resolved for me

allprojects {
    repositories {
        maven { url 'http://repo1.maven.org/maven2' }
        maven { url 'http://jcenter.bintray.com' }
    }
}
Kona Suresh
  • 1,836
  • 1
  • 15
  • 25
0

just change your dependencies orders or change buildToolsVersion to 24.0.3.

and then refresh.

Tony
  • 520
  • 4
  • 13
0

In android studio go to File-> "Invalidate Caches / Restart" -> Press "Invalidate Restart" button.

RohitK
  • 1,444
  • 1
  • 14
  • 37
-2

Try this

compile 'eu.the4thfloor.volley:com.android.volley:2015.05.28'
waqas ali
  • 1,238
  • 1
  • 11
  • 17