I am trying to extend Stringrequest from Volley package, but the import is not working, why?

Asked

Viewed 138 times

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’ve installed the Volley package correctly.

Print

Update 1:

I updated build.Gradle(Module:app) with the code below as suggested but the error persists!

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
}

print2

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 cannot find the specified file)

Unsolved.

Update 3:

Problem solved after go to build and click on clean project.

  • Have you confirmed that the library has actually been imported from Volley?

  • How do I confirm?

  • Go to your Buld.Gradle and see if you’re using the 'com.android.volley:volley:1.0.0' the 'com.mcxiaoke.volley:library-aar:1.0.0' is already DEPRECATED and has some classes that no longer work.

  • For further information, please here and see in more detail.

  • The strange thing is that I went on all build.grade and did not tell the version whether it is the mcxiaoke or the other.

  • You imported your Eclipse project?

  • This link ae that you sent me is from DEPRECATED. It would have the link of what is working?

  • I imported from android studio.

  • Precisely! I will post as answer as you have to do.

Show 4 more comments

2 answers

1


Gradle? It is to eat or to pass in the hair?

Android Studio is based on Jetbrains' Intellij IDEA, which has as one of its main Features, and often ignored, a much more modern build system based on Gradle.

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

The combination of Ant’s power and flexibility with managing Maven dependencies and conventions in a more effective way.

Configure dependencies without importing files. jar or libraries in code for the project is one of the great vangagens of using Gradle in Android development.

In the app/build.Gradle file you need to indicate your dependencies to the Gradle build, so add them in your file to your dependencies. In your case, you need to add the 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 that and Gradle takes care of downloading the dependencies, without having to import libraries into Workspace.

Read on here in this article for more details.

  • It synchronized but it appeared this error: Error:Execution failed for task ':android-Volley-master:processDebugResources'. > Error: A library uses the same package as this project: com.android.Volley

  • Insert an image of your build.grade into your question please.

  • I found the correct location where I put this code and the error has changed. Now you are asking to install missing components, I am installing.

  • Ready! I updated the question with a new print.

  • and tbm tried to trade 21 for 22 which is the latest version of appcompat but still did not solve.

  • Problem solved after going to build and clicking on clean project. Obg for help!

  • Oops! Good!!! Anything, give a shout here!!! = ) Good Luck!

Show 2 more comments

0

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

Use this import here, see if it solves:

compile 'com.android.volley:volley:1.0.0'
  • How do I use this import? I don’t quite understand what this Compile you’ve put.

  • You need to go into your build.Radle file inside the app directory, and there in that file you can see the compiles, include that line there

  • Includes but still persists error. I updated the above question with another print if you want to take a look.

  • Try clicking Build and Clean Project, see if you can solve.

  • PQP! Did you solve it? obg. kkkk

  • When you see that everything is right in the code and gives some strange errors, use this Clean Project, that Android Studio realoca everything in its proper place! I’m glad you decided...

  • blza! vlw even huh

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.