Android Volley MalformedURLException Bad URL

有些话、适合烂在心里 提交于 2019-11-29 13:23:52

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.

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);

Use http:// OR https://

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

John smith

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

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