我向我的 servlet 发出请求
尝试 {
Log.d(Constants.DEBUG_TAG_MAPS, "try");
HttpEntity 实体 = 新 StringEntity(json);
post.setEntity(实体);
HttpParams httpParameters = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParameters, 15000);
HttpConnectionParams.setSoTimeout(httpParameters, 150000);
httpclient = new DefaultHttpClient(httpParameters);
BasicHttpResponse response = (BasicHttpResponse) httpclient.execute(post);
Log.d(Constants.DEBUG_TAG_MAPS, "http 状态码:"+response.getStatusLine().getStatusCode());
if(response.getStatusLine().getStatusCode() == 200){
Log.d(Constants.DEBUG_TAG_MAPS, "响应 200");
HttpEntity responseEntity = response.getEntity();
if (responseEntity!= null) {
Gson g = 新 Gson();
InputStream 是 = responseEntity.getContent();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader reader = new BufferedReader(isr);
尝试{
responseEntity.getContent();
字符串 x = EntityUtils.toString(responseEntity);
}catch(异常 e){
// TODO: 处理异常
}
responseJSONObject = g.fromJson(reader, JSONResponseObject.class);
Log.d(Constants.DEBUG_TAG_MAPS_console, responseJSONObject.toString());
reader.close();
System.gc();
}
}
} 捕捉(异常 e){
e.printStackTrace();
}
/代码>
并在线:
InputStream 是 = responseEntity.getContent();
应用程序崩溃...响应代码为 200 ...我查看了我的 tomcat 日志,一切正常。JSONResponseObject 填充了值并发送。
可能是什么问题呢?我怎样才能让堆栈跟踪到 logcat?
一个可能相关的问题:我很清楚 logcat 中的“无法连接工厂客户端”任何可能导致该问题的事情都不是我的情况
- api 密钥正确,正确 debug.keystore 的路径
- 清单中的所有权限
- uses-library android:name="com.google.android.maps 在清单中也是如此
地图显示正确,缩放/移动时刷新。