2
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

 import code.studio.v.R;
 import code.studio.v.volley.RequestQueue;

Android studio is showing an error . Can not resolve symbol volley. I have cloned volley and added it as a module. My package name is code.studio.v

The following is my build.gradle file

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "code.studio.v"
    minSdkVersion 14
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),   'proguard-rules.pro'
    }
  }
 } 

   dependencies {
   compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.android.support:appcompat-v7:22.0.0'
  }

the following is settings.gradle file .

include ':app', ':volley'
munna ss
  • 194
  • 1
  • 2
  • 11
  • Please check this : I have already answered here. [http://stackoverflow.com/a/32367416/4018207][1] [1]: http://stackoverflow.com/a/32367416/4018207 – AndiGeeky Sep 03 '15 at 06:58
  • @MamataGelanee still red.i tried compile project(':volley') . – munna ss Sep 03 '15 at 08:00
  • @MamataGelanee still red.i tried compile project(':volley') but gradle console saysBUILD SUCCESSFUL. – munna ss Sep 03 '15 at 08:07
  • remove all your error imports and try to import again using ctrl+enter . Plus rebuild your project..!! – AndiGeeky Sep 03 '15 at 11:33

2 Answers2

2

remove module dependencies and add library dependencies..using following steps

enter image description here

  1. Right Click on project - Module Setting

enter image description here

  1. Go to dependencies- click plus(+) symbol

enter image description here

  1. type volley and enter.. select the4thfloor dependencies

Finally sync gradle and run

Angad Tiwari
  • 1,738
  • 1
  • 12
  • 23
0

If you have imported volley library as a separate module then you have to add dependency compile project(':yourVolleyModule') into your app's build.gradle. Now, Sync your gradle and i hope it will work

Kaveesh Kanwal
  • 1,753
  • 17
  • 16