Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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);
like image 938
sandeep_jagtap Avatar asked Aug 18 '13 04:08

sandeep_jagtap


2 Answers

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"
like image 81
Ye Lin Aung Avatar answered Nov 09 '22 01:11

Ye Lin Aung


I found the answer:
After googling for couple of hours I found that this kind of error occur due to problem in url
I had extra space in my URL which I removed and I got everything working

    // testing on Emulator:
    private static final String LOGIN_URL = "http://10.0.2.2:80/webservice/login.php";
like image 41
sandeep_jagtap Avatar answered Nov 09 '22 01:11

sandeep_jagtap