为什么我的OPPOR9打开 开发者选项它说应用会崩溃 怎么办 打开了oppo r9会不会卡顿应用崩溃有没有人知道

热门搜索:
当前位置: >
揭秘:你的Windows 7为什么会崩溃
来源:&&&&浏览量:
& 一切都很完美;你已升级到了Windows 7。系统打上了全部的补丁,所有驱动程序都更新了,安全很到位,说不定你甚至还有新硬件&&可是同样的蓝屏死机(BSOD)还是在新的高清屏幕上奚落你。
好消息是,你在大多数情况下可以迅速解决这个问题,只要使用Windows调试工具。这个工具简单又免费。&系统免费下载
针对不一样的Windows版本,解决崩溃的方法是否也不一样?
微软公司的主要开发负责人Andre Vachon表示,解决系统崩溃的同一种方法适用于许多的Windows版本。&微软Windows的最新版本使用同样的操作系统内核,同样的主界面,驱动程序在服务器和客户机上工作,调试器使用同样的调试文件。此外,我们都使用同样的代码库和源代码树来编译32 版本和64位版本。&
考虑到这一点,为了简单起见,我会以Windows 7为例。然而,这些要点不仅适用于其他当前的版本,大部分还适用于像Windows 2000这么久远的老版本。
Windows 7为什么会崩溃?
Windows在不断成熟,随之变得更稳定。而且,在这款操作系统从16位变成32位,再变成现在64位的过程中,功能特性也变得更丰富,占用的资源也要多得多&&它实际上更难崩溃。
尽管如此,它的确会崩溃。然而,这类系统故障的原因自XP时代以来就没有发生化变化。
Windows采用了一种保护机制,让多个应用程序可以同时运行,又不会互相干扰。这种机制名为用户模式(User Mode)或内核模式(Kernel Mode),最初名叫环保护(Ring Protection)方案。
内核模式(环0)软件可以不受限制地全面访问硬件。这种模式下运行的软件通常最值得信赖,因为它可以执行任何指令,访问系统中的任何地址。内核模式下的崩溃是彻底的系统故障,需要重新启动。你在这里可以找到操作系统的内核代码和大多数驱动程序。
用户模式(环3)软件无法直接访问硬件,也无法随意访问任何地址。它必须通过调用应用编程接口(API),来传送指令(可能更准确的说法是请求)。这项特性能够保护系统的整体运行,不管应用程序是进行错误的调用,还是访问不合适的地址。用户模式下的崩溃通常是可以恢复的,需要重新启动应用程序,但不需要重新启动整个系统。你在这里可以找到在电脑上运行的大多数代码,包括Word、单人纸牌戏和一些驱动程序等。
由于如今大多数软件在用户模式下运行,应用程序破坏系统级软件,以及破坏其他应用程序的机会完全变少了。可是,并不保护内核模式软件不受其他内核模式软件的影响。比如说,如果某个视频驱动程序错误地访问了分配给另一个程序的某部分内存(或者没有标为驱动程序可以访问的内存),Windows就会终止整个系统。这种机制叫作错误检查(Bug Check),众所周知的蓝屏死机就会显示。
透过数字看崩溃原因
虽说数字不一样,但相差不大。如果汇总几个来源报告的数据(包括本人自己20年来在预防和解决崩溃方面的经验数据),一个趋势浮出水面:大约70%的Windows系统崩溃是由内核模式下运行的第三方驱动程序引起的;15%是由未知因素引起的;10%是由有缺陷的硬件(其中一半多归咎于不良内存)引起的,只有约5%是由有缺陷的微软代码引起的。
并不广为人知的重要一点是,大多数崩溃是重复性崩溃。之所以这样,是因为大多数管理员都无法立即解决系统崩溃。因而遗憾的是,那些崩溃往往一再发生。这些事件在得到解决之前,多半会在几星期内、许多情况下会在几个月内重复发生。
《揭秘:你的Windows 7为什么会崩溃》相关内容
评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
Win7教程排行
最新系统下载
Win7教程推荐
win7系统推荐手机开启开发者选项为什么会提示会导致你的设备以及设备上的应用崩溃或者出现异常情况!_百度知道
手机开启开发者选项为什么会提示会导致你的设备以及设备上的应用崩溃或者出现异常情况!
我有更好的答案
这个是系统默认的。谢谢你支持小米手机,帮助你更准确的解决问题,开启调试后有些软件会恶意修改手机应用的。更详细的描述问题有助于网友理解你遇到的麻烦嗨
其他类似问题
为您推荐:
开发者的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁20091人阅读
Android(47)
在开发过程中,虽然经过测试,但在发布后,在广大用户各种各样的运行环境和操作下,可能会发生一些异想不到的错误导致程序崩溃。将这些错误信息收集起来并反馈给开发者,对于开发者改进优化程序是相当重要的。好了,下面就来实现这种功能吧。
(更正:日18时42分07秒)
由于为历史帖原因,以下做法比较浪费,但抓取异常的效果是一样的。
1.对于UI线程(即Android中的主线程)抛出的未捕获异常,将这些异常信息存储起来然后关闭到整个应用程序。并再次启动程序,则进入崩溃信息反馈界面让用户将出错信息以Email的形式发送给开发者。
2.对于非UI线程抛出的异常,则立即唤醒崩溃信息反馈界面提示用户将出错信息发送Email。
效果图如下[CSDN]:
过程了解了,则需要了解的几个知识点如下:
1.拦截UncaughtException
Application.onCreate()是整个Android应用的入口方法。在该方法中执行如下代码即可拦截UncaughtException:
ueHandler = new UEHandler(this);
// 设置异常处理实例
Thread.setDefaultUncaughtExceptionHandler(ueHandler);
2.抓取导致程序崩溃的异常信息
UEHandler是Thread.UncaughtExceptionHandler的实现类,在其public void uncaughtException(Thread thread, Throwable ex)的实现中可以获取崩溃信息,代码如下:
// fetch Excpetion Info
String info =
ByteArrayOutputStream baos =
PrintStream printStream =
baos = new ByteArrayOutputStream();
printStream = new PrintStream(baos);
ex.printStackTrace(printStream);
byte[] data = baos.toByteArray();
info = new String(data);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (printStream != null) {
printStream.close();
if (baos != null) {
baos.close();
} catch (Exception e) {
e.printStackTrace();
3.程序抛异常后,要关闭整个应用
悲催的程序员,唉,以下三种方式都无效了,咋办啊!!!
&&& 3.1android.os.Process.killProcess(android.os.Process.myPid());
&&& 3.2ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
&&& &&& am.restartPackage(&lab.sodino.errorreport&);
&&& 3.3System.exit(0)
&&& 好吧,毛主席告诉我们:自己动手丰衣足食。
&&& SoftApplication中声明一个变量need2Exit,其值为true标识当前的程序需要完整退出;为false时该干嘛干嘛去。该变量在应用的启动Activity.onCreate()处赋值为false。
&&& 在捕获了崩溃信息后,调用SoftApplication.setNeed2Exit(true)标识程序需要退出,并finish()掉ActErrorReport,这时ActErrorReport退栈,抛错的ActOccurError占据手机屏幕,根据Activity的生命周期其要调用onStart(),则我们在onStart()处读取need2Exit的状态,若为true,则也关闭到当前的Activity,则退出了整个应用了。此方法可以解决一次性退出已开启了多个Activity的Application。详细代码请阅读下面的示例源码。
好了,代码如下:
lab.sodino.errorreport.SoftApplication.java
package lab.sodino.
import java.io.F
import android.app.A
* @author Sodino E-mail:
* @version Time: 下午11:49:56
public class SoftApplication extends Application {
/** &/data/data/&app_package&/files/error.log& */
public static final String PATH_ERROR_LOG = File.separator + &data& + File.separator + &data&
+ File.separator + &lab.sodino.errorreport& + File.separator + &files& + File.separator
+ &error.log&;
/** 标识是否需要退出。为true时表示当前的Activity要执行finish()。 */
private boolean need2E
/** 异常处理类。 */
private UEHandler ueH
public void onCreate() {
need2Exit =
ueHandler = new UEHandler(this);
// 设置异常处理实例
Thread.setDefaultUncaughtExceptionHandler(ueHandler);
public void setNeed2Exit(boolean bool) {
need2Exit =
public boolean need2Exit() {
return need2E
lab.sodino.errorreport.ActOccurError.java
package lab.sodino.
import java.io.F
import java.io.FileInputS
import android.app.A
import android.content.I
import android.os.B
import android.util.L
import android.view.V
import android.widget.B
public class ActOccurError extends Activity {
private SoftApplication softA
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
softApplication = (SoftApplication) getApplication();
// 一开始进入程序恢复为&need2Exit=false&。
softApplication.setNeed2Exit(false);
Log.d(&ANDROID_LAB&, &ActOccurError.onCreate()&);
Button btnMain = (Button) findViewById(R.id.btnThrowMain);
btnMain.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
Log.d(&ANDROID_LAB&, &Thread.main.run()&);
int i = 0;
Button btnChild = (Button) findViewById(R.id.btnThrowChild);
btnChild.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
new Thread() {
public void run() {
Log.d(&ANDROID_LAB&, &Thread.child.run()&);
int i = 0;
}.start();
// 处理记录于error.log中的异常
String errorContent = getErrorLog();
if (errorContent != null) {
Intent intent = new Intent(this, ActErrorReport.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(&error&, errorContent);
intent.putExtra(&by&, &error.log&);
startActivity(intent);
public void onStart() {
super.onStart();
if (softApplication.need2Exit()) {
Log.d(&ANDROID_LAB&, &ActOccurError.finish()&);
ActOccurError.this.finish();
// do normal things
* 读取是否有未处理的报错信息。&br/&
* 每次读取后都会将error.log清空。&br/&
* @return 返回未处理的报错信息或null。
private String getErrorLog() {
File fileErrorLog = new File(SoftApplication.PATH_ERROR_LOG);
String content =
FileInputStream fis =
if (fileErrorLog.exists()) {
byte[] data = new byte[(int) fileErrorLog.length()];
fis = new FileInputStream(fileErrorLog);
fis.read(data);
content = new String(data);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (fis != null) {
fis.close();
if (fileErrorLog.exists()) {
fileErrorLog.delete();
} catch (Exception e) {
e.printStackTrace();
lab.sodino.errorreport.ActErrorReport.java
package lab.sodino.
import android.app.A
import android.content.I
import android.os.B
import android.util.L
import android.view.V
import android.widget.B
import android.widget.EditT
import android.widget.TextV
* @author Sodino E-mail:
* @version Time: 下午01:34:17
public class ActErrorReport extends Activity {
private SoftApplication softA
/** 标识来处。 */
private Button btnR
private Button btnC
private BtnListener btnL
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.report);
softApplication = (SoftApplication) getApplication();
by = getIntent().getStringExtra(&by&);
info = getIntent().getStringExtra(&error&);
TextView txtHint = (TextView) findViewById(R.id.txtErrorHint);
txtHint.setText(getErrorHint(by));
EditText editError = (EditText) findViewById(R.id.editErrorContent);
editError.setText(info);
btnListener = new BtnListener();
btnReport = (Button) findViewById(R.id.btnREPORT);
btnCancel = (Button) findViewById(R.id.btnCANCEL);
btnReport.setOnClickListener(btnListener);
btnCancel.setOnClickListener(btnListener);
private String getErrorHint(String by) {
String hint = &&;
String append = &&;
if (&uehandler&.equals(by)) {
append = & when the app running&;
} else if (&error.log&.equals(by)) {
append = & when last time the app running&;
hint = String.format(getResources().getString(R.string.errorHint), append, 1);
public void onStart() {
super.onStart();
if (softApplication.need2Exit()) {
// 上一个退栈的Activity有执行“退出”的操作。
Log.d(&ANDROID_LAB&, &ActErrorReport.finish()&);
ActErrorReport.this.finish();
// go ahead normally
class BtnListener implements Button.OnClickListener {
public void onClick(View v) {
if (v == btnReport) {
// 需要 android.permission.SEND权限
Intent mailIntent = new Intent(Intent.ACTION_SEND);
mailIntent.setType(&plain/text&);
String[] arrReceiver = { && };
String mailSubject = &App Error Info[& + getPackageName() + &]&;
String mailBody =
mailIntent.putExtra(Intent.EXTRA_EMAIL, arrReceiver);
mailIntent.putExtra(Intent.EXTRA_SUBJECT, mailSubject);
mailIntent.putExtra(Intent.EXTRA_TEXT, mailBody);
startActivity(Intent.createChooser(mailIntent, &Mail Sending...&));
ActErrorReport.this.finish();
} else if (v == btnCancel) {
ActErrorReport.this.finish();
public void finish() {
super.finish();
if (&error.log&.equals(by)) {
// do nothing
} else if (&uehandler&.equals(by)) {
// android.os.Process.killProcess(android.os.Process.myPid());
// ActivityManager am = (ActivityManager)
// getSystemService(ACTIVITY_SERVICE);
// am.restartPackage(&lab.sodino.errorreport&);
// System.exit(0);
// 1.2.3.都失效了,Google你让悲催的程序员情何以堪啊。
softApplication.setNeed2Exit(true);
// ////////////////////////////////////////////////////
// // 另一个替换方案是直接返回“HOME”
// Intent i = new Intent(Intent.ACTION_MAIN);
// // 如果是服务里调用,必须加入newtask标识
// i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// i.addCategory(Intent.CATEGORY_HOME);
// startActivity(i);
// ////////////////////////////////////////////////////
lab.sodino.errorreport.UEHandler.java
package lab.sodino.
import java.io.ByteArrayOutputS
import java.io.F
import java.io.FileOutputS
import java.io.PrintS
import android.content.I
import android.util.L
* @author Sodino E-mail:
* @version Time: 下午11:50:43
public class UEHandler implements Thread.UncaughtExceptionHandler {
private SoftApplication softA
private File fileErrorL
public UEHandler(SoftApplication app) {
fileErrorLog = new File(SoftApplication.PATH_ERROR_LOG);
public void uncaughtException(Thread thread, Throwable ex) {
// fetch Excpetion Info
String info =
ByteArrayOutputStream baos =
PrintStream printStream =
baos = new ByteArrayOutputStream();
printStream = new PrintStream(baos);
ex.printStackTrace(printStream);
byte[] data = baos.toByteArray();
info = new String(data);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (printStream != null) {
printStream.close();
if (baos != null) {
baos.close();
} catch (Exception e) {
e.printStackTrace();
long threadId = thread.getId();
Log.d(&ANDROID_LAB&, &Thread.getName()=& + thread.getName() + & id=& + threadId + & state=& + thread.getState());
Log.d(&ANDROID_LAB&, &Error[& + info + &]&);
if (threadId != 1) {
// 此处示例跳转到汇报异常界面。
Intent intent = new Intent(softApp, ActErrorReport.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(&error&, info);
intent.putExtra(&by&, &uehandler&);
softApp.startActivity(intent);
// 此处示例发生异常后,重新启动应用
Intent intent = new Intent(softApp, ActOccurError.class);
// 如果没有NEW_TASK标识且是UI线程抛的异常则界面卡死直到ANR
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
softApp.startActivity(intent);
// write 2 /data/data/&app_package&/files/error.log
write2ErrorLog(fileErrorLog, info);
// kill App Progress
android.os.Process.killProcess(android.os.Process.myPid());
private void write2ErrorLog(File file, String content) {
FileOutputStream fos =
if (file.exists()) {
// 清空之前的记录
file.delete();
file.getParentFile().mkdirs();
file.createNewFile();
fos = new FileOutputStream(file);
fos.write(content.getBytes());
} catch (Exception e) {
e.printStackTrace();
} finally {
if (fos != null) {
fos.close();
} catch (Exception e) {
e.printStackTrace();
/res/layout/main.xml
&?xml version=&1.0& encoding=&utf-8&?&
&LinearLayout xmlns:android=&/apk/res/android&
android:orientation=&vertical&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:layout_width=&fill_parent&
android:layout_height=&wrap_content&
android:text=&@string/hello&
&Button android:layout_width=&fill_parent&
android:layout_height=&wrap_content&
android:text=&Throws Exception By Main Thread&
android:id=&@+id/btnThrowMain&
&&/Button&
&Button android:layout_width=&fill_parent&
android:layout_height=&wrap_content&
android:text=&Throws Exception By Child Thread&
android:id=&@+id/btnThrowChild&
&&/Button&
&/LinearLayout&
/res/layout/report.xml
&?xml version=&1.0& encoding=&utf-8&?&
&LinearLayout xmlns:android=&/apk/res/android&
android:orientation=&vertical& android:layout_width=&fill_parent&
android:layout_height=&fill_parent&&
&TextView android:layout_width=&fill_parent&
android:layout_height=&wrap_content&
android:text=&@string/errorHint&
android:id=&@+id/txtErrorHint& /&
&EditText android:layout_width=&fill_parent&
android:layout_height=&wrap_content& android:id=&@+id/editErrorContent&
android:editable=&false& android:layout_weight=&1&&&/EditText&
&LinearLayout android:layout_width=&fill_parent&
android:layout_height=&wrap_content& android:background=&#96cdcd&
android:gravity=&center& android:orientation=&horizontal&&
&Button android:layout_width=&fill_parent&
android:layout_height=&wrap_content& android:text=&Report&
android:id=&@+id/btnREPORT& android:layout_weight=&1&&&/Button&
&Button android:layout_width=&fill_parent&
android:layout_height=&wrap_content& android:text=&Cancel&
android:id=&@+id/btnCANCEL& android:layout_weight=&1&&&/Button&
&/LinearLayout&
&/LinearLayout&
用到的string.xml资源为:
&string name=&errorHint&&A error has happened %1$s.Please click &i&&b&&REPORT&&/b&&/i& to send the error information to us by email, Thanks!!!&/string&
重要的一点是要在AndroidManifest.xml中对&application&节点设置android:name=&.SoftApplication&
本文内容归CSDN博客博主Sodino 所有
转载请注明出处:
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:1120346次
积分:11688
积分:11688
排名:第821名
原创:216篇
评论:518条
(13)(8)(1)(1)(3)(2)(4)(2)(2)(3)(3)(5)(2)(4)(1)(1)(5)(11)(2)(5)(1)(2)(2)(2)(4)(4)(5)(2)(2)(4)(1)(1)(4)(2)(3)(3)(3)(5)(2)(8)(7)(3)(6)(3)(2)(3)(1)(5)(12)(2)(2)(7)(4)(2)(13)(4)(4)(2)(1),小米2手机里的开发者选项,打开时,出现启用会导致设备以及设备上的应用崩溃或出现异常。_百度知道
,小米2手机里的开发者选项,打开时,出现启用会导致设备以及设备上的应用崩溃或出现异常。
,和显示.baidu! 欢迎您在百度小米企业平台提问,建议您备份重新线刷一下您的系统,这三项选择打开://zhidao.baidu,其他的建议您不要打开。除了usb调试。 感谢您的支持,和屏幕顶点显示为圆角:http
MIUI,为发烧而生
主营:互联网公司
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁}

我要回帖

更多关于 oppo r9的开发者选项 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信