Can not find symbol volley

断了今生、忘了曾经 提交于 2019-12-11 03:14:07

问题


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'

回答1:


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




回答2:


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

  1. Right Click on project - Module Setting

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

  1. type volley and enter.. select the4thfloor dependencies

Finally sync gradle and run



来源:https://stackoverflow.com/questions/32368544/can-not-find-symbol-volley

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!