gpt4 book ai didi

android - 崩溃和卡住有什么区别?

转载 作者:行者123 更新时间:2023-11-30 04:16:16 30 4
gpt4 key购买 nike

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

但是我从来没有遇到过卡住。既然谷歌努力在开发控制台中做出区分,那么区别是什么?

从一般的角度来看,崩溃显然是强制平仓。但是,如果没有强制关闭,卡住是否会简单地减慢用户体验?技术差异是什么?与崩溃相比,是否有不同的方法来解决卡住问题?

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

这里是一个崩溃的例子,堆栈跟踪非常具体地指出了一条故障线。

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)

这里是一个卡住的例子,堆栈跟踪不太具体,没有指向直接的线路或有故障的 Activity 。

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)

最佳答案

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

关于android - 崩溃和卡住有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9948210/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com