崩溃和冻结有什么区别?

时间:2012-03-30 18:04:37

标签: android debugging android-logcat

我看了一眼开发人员的控制台,第一次看到了冻结报告,而不是崩溃。崩溃很容易从堆栈跟踪中定义断点。它通常导致类/方法被错误地定义或实现。

但是我从来没有遇到过冻结。由于Google努力在开发控制台中做出区分,有什么区别?

从一般观点来看,崩溃显然是一种力量关闭。但是,如果没有强制关闭,冻结是否只会减慢用户体验?有哪些技术差异?与崩溃相比,是否有不同的方法来解决冻结问题?

编辑:添加了示例堆栈跟踪。

以下是崩溃的示例。堆栈跟踪非常具体,指向一行失败。

android.view.InflateException: Binary XML file line #21: Error inflating class android.widget.ZoomControls
at android.view.LayoutInflater.createView(LayoutInflater.java:518)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
at android.view.LayoutInflater.inflate(LayoutInflater.java:383)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at android.widget.ZoomButtonsController.createContainer(ZoomButtonsController.java:262)
at android.widget.ZoomButtonsController.<init>(ZoomButtonsController.java:211)
at android.webkit.WebView.getZoomButtonsController(WebView.java:6313)
at android.webkit.WebView.startDrag(WebView.java:5700)
at android.webkit.WebView.onTouchEvent(WebView.java:5428)
at android.view.View.dispatchTouchEvent(View.java:3885)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:903)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)

这是一个示例冻结堆栈跟踪不太具体,没有指向直接线路或故障活动。

DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0 hwl=0 hwll=0)
"main" prio=5 tid=1 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40027550 self=0xcfc0
  | sysTid=2076 nice=0 sched=0/0 cgrp=bg_non_interactive handle=-1345006240
  | schedstat=( 30958526727 7780212297 24174 )
  at android.graphics.Bitmap.nativeCreateScaledBitmap(Native Method)
  at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:556)
  at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:722)
  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:478)
  at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
  at android.content.res.Resources.loadDrawable(Resources.java:1727)
  at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
  at android.view.View.<init>(View.java:1998)
  at android.widget.TextView.<init>(TextView.java:389)


     at android.widget.Button.<init>(Button.java:108)
      at android.widget.Button.<init>(Button.java:104)
  at java.lang.reflect.Constructor.constructNative(Native Method)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
  at android.view.LayoutInflater.createView(LayoutInflater.java:505)
  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:224)
  at android.app.Activity.setContentView(Activity.java:1702)
  at com.e3h.usmcknowledge.MainActivity.onCreate(MainActivity.java:37)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1780)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1837)
  at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3242)
  at android.app.ActivityThread.access$1600(ActivityThread.java:132)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1037)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:143)
  at android.app.ActivityThread.main(ActivityThread.java:4196)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:507)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  at dalvik.system.NativeStart.main(Native Method)

2 个答案:

答案 0 :(得分:1)

确实没有正式的定义。但从广义上讲,当发生不受控制的错误时会发生崩溃。冻结是指应用程序停止响应任何事件(例如无限循环)但没有发生实际错误(没有抛出异常)。

答案 1 :(得分:0)

一般来说,崩溃是意外的,异常的退出。当程序(或整个系统)完全停止响应时,会发生冻结或挂起。