1

I am writing a java class on android studio to connect with a mysql database, but i keep receiving "cannot resolve symbol" error. No idea why. Any Help. Here is a part of the program:

import java.lang.reflect.Method;
import java.net.ResponseCache;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import java.util.HashMap;
import java.util.Map;

public class RegisterRequest extends StringRequest {
    private static final String REGISTER_REQUEST_URL = "****/Register.php";
    private Map<String, String> params;
    public RegisterRequest(String username, String password, String email, Response.Listener<String> listner){
        super(Method.POST, REGISTER_REQUEST_URL, listner, null);
        params = new HashMap<>();
        params.put("username",username);
        params.put("password",password);
        params.put("email",email);
}
    @Override
    public Map<String, String> getParams() {
        return params;
 }
 }

I receiving error "Cannot resolve symbol" for: StringRequest, Response, POST Also error "Method does not override Method from it superclass" for: @Override

Note: all volley imports are marked as unused.

Any Help ?!!

moh19814
  • 133
  • 1
  • 1
  • 14
  • Did you find a solution to this? The idea of downloading and compiling the source into a local library doesn't feel right--doesn't seem like this should be a problem.. – John Ward Dec 01 '16 at 23:21

2 Answers2

1

Did you use 'compile com.mcxiaoke.volley:library-aar:1.0.0' as your volley library? If yes, don't use it. It's not yet maintained (the updates) - deprecated. I suggest you use the original library (copy and paste this one below)

compile 'com.android.volley:volley:1.0.0' .

For more discussion just to this link .

Community
  • 1
  • 1
RoCkDevstack
  • 3,517
  • 7
  • 34
  • 56
0

To solve this issue:

  • download the volley library and create a libs folder in your app directory
  • then copy and paste the volley library into the libs folder you created.
  • Finally, right click on the volley library and select add as a library and clean your project.

If an error remains, press ALT + Enter at each error. It may occur where super(Method.POST, .. can give you an error change it to :

super(Request.Method.POST
Ryan Vincent
  • 4,483
  • 7
  • 22
  • 31