许久没来,这么多人骂我!其实这个红框不是4.0的bug,把编译模式从eng改成user就可以了,红框只是eng模式debug的时候提示你系统busy,这个时候系统可能会挂掉,仅此而已!你可以直接adb shell在system/build.prop里修改模式,改完了重启就能看到效果,或者在源码android/build下面把编译模式改成user,最彻底的是直接在编译android的时候就用user模式,这样可能会有一些权限问题,编译出来的系统和eng差别比较大,需要自己拷贝一些权限类文件,就是permission啥的这个问题我也是用google搜索android red frame才知道怎么回事的,百度...还是算了吧!
5楼我告诉你:
这个应该是Android 3.0/4.0对于多平台开发中引入的一个bug.可以通过console或者adb中设置下列属性去Disable
setprop persist.sys.strictmode.visual 0 (针对3.0)
setprop persist.sys.strictmode.disable 1 (针对4.0)以下帖子中有详细讨论,
http://groups.google.com/group/android-x86/browse_thread/thread/c61531cc5e244e35/9f3d785ff7b5c87f
进行如下操作。1、获得root权限:adb root2、设置/system为可读写:adb remount3、将hosts文件复制到PC:adb pull /system/etc/hosts d:/build.prop4、修改PC机上文件
false 改成0,true 改成false
persist.sys.strictmode.visual=0
persist.sys.strictmode.disable=15、将PC机上文件复制到手机:adb push d:/build.prop /system/etc/hosts如果要查看是否修改成功,可以在PC上执行adb shell,运行cat /system/etc/hosts;或者在手机上运行cat /system/etc/hosts。6.重启
@TargetApi(11)
public static void enableStrictMode() {
if (Utils.hasGingerbread()) {
StrictMode.ThreadPolicy.Builder threadPolicyBuilder =
new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog();
StrictMode.VmPolicy.Builder vmPolicyBuilder =
new StrictMode.VmPolicy.Builder()
.detectAll()
.penaltyLog(); if (Utils.hasHoneycomb()) {
threadPolicyBuilder.penaltyFlashScreen();
vmPolicyBuilder
.setClassInstanceLimit(MainActivity.class, 1);
}
StrictMode.setThreadPolicy(threadPolicyBuilder.build());
StrictMode.setVmPolicy(vmPolicyBuilder.build());
}
}