vpk安装错误0xffffe Android Crash问题分析以及解决
发布时间:2017-04-10
来源:服务器之家
1.问题介绍
Crash问题,无论是java侧还是native侧,在日常测试中经常会遇到。
Crash问题一般我们可以分为两类,一类是java侧的crash问题也就是抛出exception问题,这一类相对简单。
另一类是native侧的问题,由于是c++或者是c,所以相对较为复杂。
另外,kernel部分的crash暂且不提。
2.分析过程
分析过程主要分两部分,按照不同的问题来做分析。
(1).java侧问题
java侧出现exception抛出但是并没有栈上任何一层都没有一个地方catch住的话,最终将会使程序崩溃。
这种exception一般最终将会在slog中体现,一般如下所示
"accesslog">12-28 23:32:27.143: D/AndroidRuntime(337): Shutting down VM
12-28 23:32:27.143: W/dalvikvm(337): threadid=1: thread exiting with uncaught exception (group=0x40015560)
12-28 23:32:27.173: E/AndroidRuntime(337): FATAL EXCEPTION: main
12-28 23:32:27.173: E/AndroidRuntime(337): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wtaylorjr2001.practice/com.wtaylorjr2001.practice.PracticeActivity}: java.lang.NullPointerException
12-28 23:32:27.173: E/AndroidRuntime(337): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
12-28 23:32:27.173: E/AndroidRuntime(337): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
12-28 23:32:27.173: E/AndroidRuntime(337): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-28 23:32:27.173: E/AndroidRuntime(337): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
12-28 23:32:27.173: E/AndroidRuntime(337): at android.os.Handler.dispatchMessage(Handler.java:99)
12-28 23:32:27.173: E/AndroidRuntime(337): at android.os.Looper.loop(Looper.java:123)
12-28 23:32:27.173: E/AndroidRuntime(337): at android.app.ActivityThread.main(ActivityThread.java:3683)
12-28 23:32:27.173: E/AndroidRuntime(337): at java.lang.reflect.Method.invokeNative(Native Method)
12-28 23:32:27.173: E/AndroidRuntime(337): at java.lang.reflect.Method.invoke(Method.java:507)
12-28 23:32:27.173: E/AndroidRuntime(337): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-28 23:32:27.173: E/AndroidRuntime(337): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-28 23:32:27.173: E/AndroidRuntime(337): at dalvik.system.NativeStart.main(Native Method)
12-28 23:32:27.173: E/AndroidRuntime(337): Caused by: java.lang.NullPointerException
12-28 23:32:27.173: E/AndroidRuntime(337): at com.wtaylorjr2001.practice.PracticeActivity.onCreate(PracticeActivity.java:24)
12-28 23:32:27.173: E/AndroidRuntime(337): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-28 23:32:27.173: E/AndroidRuntime(337): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
12-28 23:32:27.173: E/AndroidRuntime(337): ... 11 more
log中会将该exception的调用栈打出,我们可以跟踪该调用栈进行一步步分析。
此外,由于在一般代码中通常会多次迭代打包exception,比如
1071 try {
1072 implementation = Class.forName(className, true, cl);
1073 lastClassName = className;
1074 } catch (Exception e) {
1075 throw new NoSuchAlgorithmException(type + " " + algorithm + " implementation not found: " + e);
1076 }
如果我们需要查看这个e的调用栈,我们可以在catch block中添加e.printStackTrace()
即可打印Exception e的调用栈。
(2).natvie侧crash问题
native侧crash问题较为复杂。我们需要用到以下工具
32bit:
arm-eabi-addr2line
arm-eabi-gdb
64bit:
aarch64-linux-android-addr2line
aarch64-linux-android-gdb
尽管32bit与64bit工具不同,实际上操作方法一致,我们以64bit为例。
我们举个实际例子来解释
Bug 542978 - [TJ][Telephony][SC9850S][full]点击信息中的网址超链接,偶见“浏览器停止运行”:
现在出现一native crash问题,log中有如下错误报告:
Build fingerprint: 'SPRD/sp9850s_2h10_native/sp9850s_2h10:6.0/MRA58K/W16.12.1N15:userdebug/test-keys'
Revision: '0'
ABI: 'arm64'
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x170cbeee0
x0 0000000170cbeec0 x1 0000007f7cebecec x2 0000007f7cebecec x3 0000007f8d601054
x4 0000000000000001 x5 0000000000000000 x6 0000014e0000058d x7 0000000200000000
x8 0000000000000000 x9 0000000000182012 x10 0000000000001eee x11 0000000039ca6b46
x12 0000000000000018 x13 ffffffffa91703af x14 0032c69c8c000000 x15 003b9aca00000000
x16 0000007f939018b0 x17 0000007fa5d27854 x18 0000000000000008 x19 0000000170cbeec0
x20 0000000170cbeec0 x21 0000007f7cebecec x22 0000000000000000 x23 0000007f7cebee90
x24 0000000000000001 x25 0000007f93940000 x26 0000007f92851328 x27 0000007f8ce03670
x28 0000000000001000 x29 0000007f7cebeca0 x30 0000007f90ae66f8
sp 0000007f7cebeca0 pc 0000007f90548cd8 pstate 0000000020000000
v0 00000000000000000000000000000000 v1 00000000000000000000000000000000
v2 00000000000000000000000000000000 v3 00000000000000000000000000000000
v4 00000000000031d100000000000021d1 v5 00000000000000040000000000000004
v6 00000000000000020000000000000002 v7 00000000000001d100000000000001d1
v8 00000000000000000000007f8ce03f90 v9 00000000000000000000