Error: package com.android.volley does not exist

I am trying to add Volley to my Android project in Android Studio. I downloaded Volley from git and added it as a module using the Project Structure tool as an android library. I have fixed bugs in the assembly version that I managed to compile with the new module added to my project. I started writing code and Volley stuff even showed up in my car and the packages were automatically added to the source file.

But when I compile I get error: package com.android.volley does not exist

Does anyone know what my problem is?

here is my project structure: enter image description here

here are my build.gradle apps:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.loop"
        minSdkVersion 15
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v13:20.0.0'
    compile 'com.google.android.gms:play-services:4.4.+'
}

      

and settings.gradle:

include ':app', ':volley'

+3


source to share


3 answers


I had to add compile project(':volley')

to my dependencies in build.gradle file

so the final code is



dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v13:20.0.0'
    compile 'com.google.android.gms:play-services:4.4.+'
    compile project(':volley')
}

      

+9


source


This will work as well. Add this to the last one from Build.gradle



dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:design:23.0.0'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
}

      

0


source


Just add this to your dependency

compile 'com.mcxiaoke.volley:library-aar:1.0.0'

      

0


source







All Articles