Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/203.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 解析服务器错误json响应错误代码100_Android_Json_Parse Platform_Jsonexception - Fatal编程技术网

Android 解析服务器错误json响应错误代码100

Android 解析服务器错误json响应错误代码100,android,json,parse-platform,jsonexception,Android,Json,Parse Platform,Jsonexception,我使用它来创建parse server的本地实例。我下载并设置了这个示例,它运行得很好,但是当我尝试使用android SDK时,我遇到了这个错误 02-12 22:41:58.662 7211-7211/com.christoandrew.android.authens W/System.err﹕ com.parse.ParseRequest$ParseRequestException: bad json response 02-12 22:41:58.662 7211-721

我使用它来创建parse server的本地实例。我下载并设置了这个示例,它运行得很好,但是当我尝试使用android SDK时,我遇到了这个错误

02-12 22:41:58.662    7211-7211/com.christoandrew.android.authens 

W/System.err﹕ com.parse.ParseRequest$ParseRequestException: bad json response
02-12 22:41:58.662    7211-7211/com.christoandrew.android.authens W/System.err﹕ at com.parse.ParseRequest.newTemporaryException(ParseRequest.java:290)
02-12 22:41:58.662    7211-7211/com.christoandrew.android.authens W/System.err﹕ at com.parse.ParseRESTCommand.onResponseAsync(ParseRESTCommand.java:308)
02-12 22:41:58.662    7211-7211/com.christoandrew.android.authens W/System.err﹕ at com.parse.ParseRequest$3.then(ParseRequest.java:137)
02-12 22:41:58.662    7211-7211/com.christoandrew.android.authens W/System.err﹕ at com.parse.ParseRequest$3.then(ParseRequest.java:133)
02-12 22:41:58.662    7211-7211/com.christoandrew.android.authens W/System.err﹕ at bolts.Task$15.run(Task.java:917)
02-12 22:41:58.662    7211-7211/com.christoandrew.android.authens W/System.err﹕ at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
02-12 22:41:58.662    7211-7211/com.christoandrew.android.authens W/System.err﹕ at bolts.Task.completeAfterTask(Task.java:908)
02-12 22:41:58.662    7211-7211/com.christoandrew.android.authens W/System.err﹕ at bolts.Task.continueWithTask(Task.java:715)
02-12 22:41:58.662    7211-7211/com.christoandrew.android.authens W/System.err﹕ at bolts.Task.continueWithTask(Task.java:726)
02-12 22:41:58.674    7211-7211/com.christoandrew.android.authens W/System.err﹕ at bolts.Task$13.then(Task.java:818)
02-12 22:41:58.674    7211-7211/com.christoandrew.android.authens W/System.err﹕ at bolts.Task$13.then(Task.java:806)
02-12 22:41:58.682    7211-7211/com.christoandrew.android.authens W/System.err﹕ at bolts.Task$15.run(Task.java:917)
02-12 22:41:58.682    7211-7211/com.christoandrew.android.authens W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
02-12 22:41:58.682    7211-7211/com.christoandrew.android.authens W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
02-12 22:41:58.682    7211-7211/com.christoandrew.android.authens W/System.err﹕ at java.lang.Thread.run(Thread.java:841)
02-12 22:41:58.682    7211-7211/com.christoandrew.android.authens W/System.err﹕ Caused by: org.json.JSONException: Value Cannot of type java.lang.String cannot be converted to JSONObject
02-12 22:41:58.682    7211-7211/com.christoandrew.android.authens W/System.err﹕ at org.json.JSON.typeMismatch(JSON.java:111)
02-12 22:41:58.682    7211-7211/com.christoandrew.android.authens W/System.err﹕ at org.json.JSONObject.<init>(JSONObject.java:159)
02-12 22:41:58.682    7211-7211/com.christoandrew.android.authens W/System.err﹕ at org.json.JSONObject.<init>(JSONObject.java:172)
02-12 22:41:58.682    7211-7211/com.christoandrew.android.authens W/System.err﹕ at com.parse.ParseRESTCommand.onResponseAsync(ParseRESTCommand.java:298)
02-12 22:41:58.690    7211-7211/com.christoandrew.android.authens W/System.err﹕ ... 13 more
这就是我初始化的方式

Parse.enableLocalDatastore(this);
    Parse.initialize(new Parse.Configuration.Builder(this)
            .applicationId(getString(R.string.parse_app_id))
            .clientKey(getString(R.string.parse_client_key))
            .server("http://10.0.3.2:1337/parse")
            .build());
    Parse.setLogLevel(Parse.LOG_LEVEL_VERBOSE);
就像在教程中一样。我正在使用GenyMoon作为运行10.0.3.2的虚拟设备。我是否遗漏了什么,或者这是一个普遍的问题

更新

如果我使用cmd中的curl,效果会非常好

curl -X POST -H "X-Parse-Application-Id: UBXrCTUXuXf6fEBpbE7sHBamq4b0RdQcASFTHxo9" -H "X-Parse-Client-Key: 4m2WpkkGCX77w3FNq3JWT74nVgRKNsgTj10Q1s4t" -H "Content-Type: application/json" -d @json.txt http://localhost:1337/parse/classes/GameScore
我找到了解决办法。 而不是这个

.server("http://10.0.3.2:1337/parse")
用这个

.server("http://10.0.3.2:1337/parse/")

我也遇到同样的问题。你找到解决方案了吗?还没有尝试这也是我做的。检查我的回答,确保你的服务器url后面有一个
/
。愚蠢的错误,谢谢你指出。哇,谢谢。我永远不会抓到这个,因为它在服务器上没有斜杠
.server("http://10.0.3.2:1337/parse/")