org.json.JSONException: End of input at character 0 of, android

后端 未结 2 956
伪装坚强ぢ
伪装坚强ぢ 2021-01-21 17:00

I am implementing an android app and trying to make a register and login screens. my app is connected to a server, here is the part my code that makes error:

pub         


        
2条回答
  •  Happy的楠姐
    2021-01-21 17:32

    As you have seen in your logcat 1576-1576/com.example.neshat.androidhive2 D/RegisterActivity﹕ Register Response: which is the result of Log.d(TAG, "Register Response: " + response.toString());, response is an empty string, so your app will get org.json.JSONException: End of input at character 0 of at the line JSONObject jObj = new JSONObject(response);.

    You should check response is not null and not an empty string first.

提交回复
热议问题