Getting a JSONException: end of input at character 0

You are probably getting a blank response. Its not null but the response is empty. So you are getting this error and not a Nullpointer exception


Check if you are asking for permissions to use the Internet.

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

in the Android Manifest

Check out others at Permissions overview @ https://developer.android.com.


May be you are getting default response with default values. This kind of error comes up when you are not sending your requests properly or sending with wrong parameters. Check This


Sometimes this error is caused as json encode function requires all incoming data to be UTF-8 encoded.

Try adding mysqli_set_charset($con, 'utf8'); into your php.