我正在对google的方向服务进行查询,但是执行方法中途崩溃了,这是代码
Uri.Builder b = Uri.parse("http://maps.googleapis.com/maps/api/directions/json").buildUpon();
b.appendQueryParameter("origin", "The University of Hong KOng");
b.appendQueryParameter("destination", "Lee Hysan Hall");
b.appendQueryParameter("sensor", "false");
b.appendQueryParameter("language", "en_US");
String finalstr = b.build().toString();
URI googledirectionservice = new URI(finalstr);
HttpGet mRequest = new HttpGet(googledirectionservice);
HttpClient mClient = new DefaultHttpClient();
response = mClient.execute(mRequest);
当我从浏览器访问它时,构造的 url 很好,但是从 HttpClient 访问它不起作用。您可以仔细检查
http://maps.googleapis.com/maps/api/directions/json?origin=The%20University%20of%20Hong%20KOng&destination=Lee%20Hysan%20Hall&sensor=false&language=en_US
原因是什么?此外,我怎样才能使调试信息更丰富?logcat 中的当前显示仅
threadid=... thread exiting with uncaught exception