无法获得corect gson响应kitkat设备

时间:2016-04-22 14:22:34

标签: android json gson android-volley

嗨我有问题在4.42中获得json响应。实际上我正在使用Volley和Gson来获取Web api。我在Lollipop,Marshmallow和kitkat 4.3中获得了正确的响应。但是在kitkat 4.4.2和以下版本我得到了错误。我的Log cat是

04-22 18:25:48.893 4799-4799/graffititechnologies.teachertalk E/IMGSRV: :0: PVRDRMOpen: TP3, ret = 50
04-22 18:25:48.893 4799-4799/graffititechnologies.teachertalk E/IMGSRV: :0: PVRDRMOpen: TP3, ret = 53
04-22 18:25:48.893 4799-4799/graffititechnologies.teachertalk E/IMGSRV: :0: PVRDRMOpen: TP3, ret = 54
04-22 18:25:48.893 4799-4799/graffititechnologies.teachertalk E/IMGSRV: :0: PVRDRMOpen: TP3, ret = 54
04-22 18:25:48.893 4799-4799/graffititechnologies.teachertalk E/IMGSRV: :0: PVRDRMOpen: TP3, ret = 54
04-22 18:25:48.903 4799-4799/graffititechnologies.teachertalk E/IMGSRV: :0: PVRDRMOpen: TP3, ret = 56
04-22 18:26:01.243 4799-4799/graffititechnologies.teachertalk E/Url is: >>>>>>>>> http://www.graffititechnologies.com/teacher_talk/index.php/user/user_login
04-22 18:26:01.343 4799-4817/graffititechnologies.teachertalk E/parameters: >>>>>>>>> {password=1, username=swaroop}
04-22 18:26:01.443 4799-4799/graffititechnologies.teachertalk E/Verification_response..: <HTML><HEAD>
     <meta http-equiv=pragma content=nocache>
     <META HTTP-EQUIV=Expires CONTENT=-1>
     <SCRIPT>
        location.href="http://10.10.4.254:8090/httpclient.html?u=http://www.graffititechnologies.com/teacher_talk/index.php/user/user_login"
     </SCRIPT>
     </HEAD><BODY>
     </BODY>
     </HTML>
04-22 18:26:01.463 4799-4799/graffititechnologies.teachertalk E/AndroidRuntime: FATAL EXCEPTION: main
    Process: graffititechnologies.teachertalk, PID: 4799
    com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: 

Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:187)
    at com.google.gson.Gson.fromJson(Gson.java:805)
    at com.google.gson.Gson.fromJson(Gson.java:770)
    at com.google.gson.Gson.fromJson(Gson.java:719)
    at com.google.gson.Gson.fromJson(Gson.java:691)
    at graffititechnologies.teachertalk.modules.login.LoginActivity$1.onResponse(LoginActivity.java:92)
    at graffititechnologies.teachertalk.modules.login.LoginActivity$1.onResponse(LoginActivity.java:85)
    at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:60)
    at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:30)
    at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:99)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:149)
    at android.app.ActivityThread.main(ActivityThread.java:5061)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:603)
    at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
    at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:387)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176)
    at com.google.gson.Gson.fromJson(Gson.java:805) 
    at com.google.gson.Gson.fromJson(Gson.java:770) 
    at com.google.gson.Gson.fromJson(Gson.java:719) 
    at com.google.gson.Gson.fromJson(Gson.java:691) 
    at graffititechnologies.teachertalk.modules.login.LoginActivity$1.onResponse(LoginActivity.java:92) 
    at graffititechnologies.teachertalk.modules.login.LoginActivity$1.onResponse(LoginActivity.java:85) 
    at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:60) 
    at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:30) 
    at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:99) 
    at android.os.Handler.handleCallback(Handler.java:733) 
    at android.os.Handler.dispatchMessage(Handler.java:95) 
    at android.os.Looper.loop(Looper.java:149) 
    at android.app.ActivityThread.main(ActivityThread.java:5061) 
    at java.lang.reflect.Method.invokeNative(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:515) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:603) 
    at dalvik.system.NativeStart.main(Native Method) 

04-22 18:31:01.923 9526-9526/graffititechnologies.teachertalk E/IMGSRV: :0: PVRDRMOpen: TP3, ret = 50
04-22 18:31:01.923 9526-9526/graffititechnologies.teachertalk E/IMGSRV: :0: PVRDRMOpen: TP3, ret = 53
04-22 18:31:01.923 9526-9526/graffititechnologies.teachertalk E/IMGSRV: :0: PVRDRMOpen: TP3, ret = 54
04-22 18:31:01.923 9526-9526/graffititechnologies.teachertalk E/IMGSRV: :0: PVRDRMOpen: TP3, ret = 54
04-22 18:31:01.923 9526-9526/graffititechnologies.teachertalk E/IMGSRV: :0: PVRDRMOpen: TP3, ret = 54
04-22 18:31:01.933 9526-9526/graffititechnologies.teachertalk E/IMGSRV: :0: PVRDRMOpen: TP3, ret = 56

0 个答案:

没有答案