我正在编写一个 android 应用程序,该应用程序使用HttpClient
Apache Commons 项目的接口发出请求(两个版本的 android 都提供)。
问题出现在以下代码清单中:
try {
URI uri = URIUtils.createURI(SCHEME, host, DEFAULT_PORT, QUERY,
URLEncodedUtils.format(qparams, ENCODING), EMPTY_FRAGMENT);
HttpUriRequest request = new HttpGet(uri);
response = client.execute(request);
} catch (Exception e) {
throw new CheckedSecurityException("Could not execute request", e);
}
Android 2.2 可以很好地做到这一点(API 级别 8),但是当我在 Android 2.1-update1(API 级别 7)上运行它时,它“挂起”在client.execute(request)
. 我究竟做错了什么?