java.lang.IllegalArgumentException: Illegal character in authority at index 7 while making https request

sandeep_jagtap picture sandeep_jagtap · Aug 18, 2013 · Viewed 20.4k times · Source

While making http request to my local wamp server from android emulator I got above error.

// testing on Emulator:
private static final String LOGIN_URL="http:// 10.0.2.2:80/webservice/login.php";

//request:
JSONObject json = jsonParser.makeHttpRequest(LOGIN_URL, "POST", params);

Answer

Ye Lin Aung picture Ye Lin Aung · Aug 18, 2013

You have a space at index 7 of your string LOGIN_URL and it is causing the exception. It should be like this.

LOGIN_URL = "http://10.0.2.2:80/webservice/login.php"