I'm trying to extend StringRequest from the volley package, but the import is not working, why?

3

This is the code I use to import.

import com.android.volley.Response;
import com.android.volley.toolbox.StringRequest;

And here below is a print of my screen showing that I have already installed the volley package correctly.

Update1:

Iupdatedthebuild.grad(Module:app)withthecodebelowassuggestedbuttheerrorpersists!

dependencies{compilefileTree(dir:'libs',include:['*.jar'])compile'com.android.support:appcompat-v7:21.0.3'compile'com.android.volley:volley:1.0.0'//estenãoestáDEPRECATED}

Error: Execution failed for task ': android-volley-master: processDebugAndroidTestResources'.

  

java.io.FileNotFoundException: D: \ Smoacademy \ android-volley-master \ build \ intermediates \ symbols \ androidTest \ debug \ R.txt (The system can not find the file specified)

No resolution yet.

Update 3:

Problem solved after going into build and clicking clean project.

    
asked by anonymous 19.08.2016 / 20:41

2 answers

1

Gradle? Is it eating or ironing?

Android Studio is based on JetBrains IntelliJ IDEA, which has one of its main features, and often overlooked, a new, much more modern build based on gradle.

Gradle is a build automation system, just like Ant and Maven, and can be defined as follows:

  

Combining Ant's power and flexibility with   dependencies and conventions of Maven in a more effective way.

Configuring dependencies without having to import .jar files or code libraries into the project is one of the big drawbacks of using gradle in Android development.

In the app / build.gradle file you need to tell the gradle build its dependencies, then add those in your dependencies file. In your case, you need to add volley .

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

    compile 'com.android.volley:volley:1.0.0' //este não está DEPRECATED
}

Just this and the gradle takes care of downloading the dependencies, without having to import libraries into the workspace.

Read here in this article for more details.

    
19.08.2016 / 21:12
0

Are you using the official Android Volley? The others are all obsolete.

Use this import here, see if it resolves:

compile 'com.android.volley:volley:1.0.0'
    
19.08.2016 / 20:49