解决办法:
在发起Http请求的Activity里面的onCreate函数里面添加如下代码:
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectDiskReads().detectDiskWrites().detectNetwork() .penaltyLog().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() .detectLeakedSqlLiteObjects().detectLeakedClosableObjects() .penaltyLog().penaltyDeath().build());
其他方法见:http://blog.csdn.net/mad1989/article/details/25964495
时间: 2024-10-08 03:08:53