网络主线程异常
我刚刚在官方文档中发现了 NetworkOnMainThreadException
I just found out about NetworkOnMainThreadException at official docs
并且想知道模拟器是否正在抛出这个.我一直在测试我的应用程序,据我所知,所有网络都在主线程之外(使用 Roboguice RoboAsyncTask),但你永远不知道是否有一个没有逃脱.
and was wondering if the emulator is throwing this. I have been testing my app quite a bit and as far as I know all networking is off the main thread (using Roboguice RoboAsyncTask) but you never know if one has not escaped.
我也在使用 StrictMode,但什么也没看到.
I am also using StrictMode and have not seen anything.
我的代码是干净的还是没有被抛出到模拟器上?
Is my code just clean or is this not thrown on the emulator?
我们应该如何为生产中发生的这种情况做好准备?
How are we supposed to prepare for this happening in production?
宽限期什么的?或者现在已经过去了;-) ??
What about a grace period or something? Or is that elapsed now ;-) ??
我已经对此进行了测试,实际上它也发生在模拟器上.如果您打算将应用安装到 3.0 及更高版本的平板电脑上,最好确保至少在模拟器上测试您的应用.
I have tested this and it does in fact happen on the emulator as well. Better make sure you test your app at least on the emulator if you plan to get it onto the 3.0 tablets and beyond.