本文介绍了API交换机触发StrictMode违反政策的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

说,我与Android 2.3.3是一半,然后我找到了一些API,我需要,但只在Android 4.0的支持。因此,我通过检查不同的项目建设目标切换到Android 4.0。现在,这里是一个 StrictMode违反政策,政策= 2711,违反= 1 将消失,当我切换回来。所以我觉得开关责怪,但有什么办法来工作,而不是建立一个新的项目解决此问题?

say, I'm halfway with Android 2.3.3 and then I find some APIs which I need but are only supported in Android 4.0. Thus, I switch to Android 4.0 by checking a different Project Build Target. Now here comes a StrictMode policy violation, policy=2711, violation=1 which will go away when I switch back. So I think the switch is to blame but is there a way to work around this instead of building a new project?

更新:结果
即使我开始一个新项目,与Android 4.0,但具有相同codeS,还是严格的政策违反

推荐答案

StrictMode违反政策,政策= 2711,违反= 1 似乎是一个 StrictModeDiskWriteViolation 。当您执行磁盘写入主UI线程上发生的磁盘写入冲突。为了解决这个问题,你需要移动磁盘写入关闭主线程。在这种情况下,它可能是一些在4.0已经改变,现在包括磁盘写入,这意味着你需要改变你的code,这样你不再4.0使用该功能在主线程。Android的功能

StrictMode policy violation, policy=2711, violation=1 seems to be a StrictModeDiskWriteViolation. A disk write violation occurs when you are performing disk writes on the main UI thread. To solve it, you need to move the disk writes off the main thread. In this case it could be that some Android functionality that has changed in 4.0 and now includes disk writes, meaning you need to change your code such that you no longer use that functionality on the main thread in 4.0.

你能发布完整的堆栈跟踪?这应该对正在发生的事情的细节。

Can you post the full stack trace? That should have details about what is happening.

这联系也可能会有所帮助:

This link may also be helpful:http://www.google.com/support/forum/p/Google+Mobile/thread?tid=10b73a621438323f

这篇关于API交换机触发StrictMode违反政策的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 19:53