Can not find symbol volley

2019-07-12 16:25发布

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'

2条回答
Animai°情兽
2楼-- · 2019-07-12 16:47

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

查看更多
乱世女痞
3楼-- · 2019-07-12 16:52

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

查看更多
登录 后发表回答