Android Volley MalformedURLException Bad URL

后端 未结 4 573
抹茶落季
抹茶落季 2020-12-20 11:25

After making a second network request using Volley, I always get this error. It doesn\'t seem to matter what the url I put in is. Volley always c

相关标签:
4条回答
  • 2020-12-20 11:42

    actually the problem is with your url not with the volley. Your Url is not a URI. There is no protocol component in it. It needs http:// or whatever other protocol you intend. If you have the http in your url make sure where it is correctly formed or not.

    For example your url formation should be like this

    public String URL = "http://www.w3schools.com/webservices/tempconvert.asmx";
    

    Don’t forget to read the URL Specification and make sure the URL you are providing is valid.

    0 讨论(0)
  • 2020-12-20 11:45

    Use http:// OR https://

    prefix to your URL example: example.com/information.json write it as http://example.com/information.json

    0 讨论(0)
  • 2020-12-20 11:56

    this Exception occur while you are hitting an Url that is not prefixed withhttp// or https//.so check there is therehttp// is with your URL. you can get more information here and see these links

    0 讨论(0)
  • 2020-12-20 12:00

    Make Sure that you have passed the URL as the second parameter in JsonObjectRequest or StringRequest. I made the same mistake which produced the same error like what you faced.

    JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Method.POST, URL, null, ResponseListener, ErrorListener);
    
    0 讨论(0)
提交回复
热议问题