Caused by: com.google.gson.TokenMgrError: Lexical error at line 1, column 1. Encountered: "<" (60), after : "" <p>In my android application I am facing a very strange error and cannot get into root of it. I making a network call and parsing the JSON response. But the application crashes and I receive the following error.</p> <p>It occurs randomly and unable to reproduce the error. It would be very handy if some one who have faced this before could tell me what possibly could trigger this crash.</p> <pre><code>com.google.gson.JsonParseException: Failed parsing JSON source: java.io.StringReader@40e13578 to Json at com.google.gson.JsonParser.parse(JsonParser.java:57) at com.google.gson.Gson.fromJson(Gson.java:443) at com.google.gson.Gson.fromJson(Gson.java:396) at com.google.gson.Gson.fromJson(Gson.java:372) at com.xyz.getStaffFromJson(JsonUtils.java:201) at com.xyz.getMyDetails(WebAPI.java:666) at com.xyz.OptimisedSyncService.onHandleIntent(OptimisedSyncService.java:147) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:156) at android.os.HandlerThread.run(HandlerThread.java:60) Caused by: com.google.gson.TokenMgrError: Lexical error at line 1, column 1. Encountered: \"&lt;\" (60), after : \"\" at com.google.gson.JsonParserJavaccTokenManager.getNextToken(JsonParserJavaccTokenManager.java:1168) at com.google.gson.JsonParserJavacc.jj_ntk(JsonParserJavacc.java:635) at com.google.gson.JsonParserJavacc.parse(JsonParserJavacc.java:10) at com.google.gson.JsonParser.parse(JsonParser.java:54) ... 10 more com.google.gson.TokenMgrError: Lexical error at line 1, column 1. Encountered: \"&lt;\" (60), after : \"\" at com.google.gson.JsonParserJavaccTokenManager.getNextToken(JsonParserJavaccTokenManager.java:1168) at com.google.gson.JsonParserJavacc.jj_ntk(JsonParserJavacc.java:635) at com.google.gson.JsonParserJavacc.parse(JsonParserJavacc.java:10) at com.google.gson.JsonParser.parse(JsonParser.java:54) at com.google.gson.Gson.fromJson(Gson.java:443) at com.google.gson.Gson.fromJson(Gson.java:396) at com.google.gson.Gson.fromJson(Gson.java:372) at com.xyz.getStaffFromJson(JsonUtils.java:201) at com.xyz.getMyDetails(WebrosterAPI.java:666) at com.xyz.OptimisedSyncService.onHandleIntent(OptimisedSyncService.java:147) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:156) at android.os.HandlerThread.run(HandlerThread.java:60) </code></pre> <p>Sample response : {"mcode":"123","mobilesettings":{"mobile":"07405123154","email":"rcb@rtc.com","telephone":"0174465599","timeout":20,"mail_address":"abc.gmail.com","mail_user":"mail.user@gmail.com","mail_password":"password","task_state":0,"force_task_reason":0,"allow_free_task_reason":1,"unsent_sync":10,"booking_sync":240,"default_scan_mode":0,"gps_enabled":1,"gps_poll_interval":5,"minimum_gps_accuracy":100.0,"allow_blank_aborted_reason":false,"allow_free_aborted_reason":true},"staff":{"json_class":"Staff","staff_id":1234,"title":"","fname":"rags","mname":"","sname":"rags","location_id":321,"pager":"","mobile":"07444456789","email":"abc@def.com","website":"","dob":null,"job_title":"","uid_ref":1,"dt_stamp":"Tue Feb 11 13:13:44 +0000 2014","pin_no":"","wroptions":0,"dt_created":"Wed Dec 04 16:13:08 +0000 2013","user_created":1,"pin_start":"1234","pin_end":"1234","payroll_report":"Payroll.xml","external_payroll_ref":"","payroll_export":"Payroll.sql","supplier":0,"is_saved":1}}</p>