NativeScript / NativeScript/firebase
[Crashlytics] How can we get a better stack trace?
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 62
- 派生
- 53
- 平均合并
- 8 天 4 小时
- 30 天内合并 PR
- 2
描述
As the title asks, is there a better way for us to build the app, or use the Crashlytics plugin, so that we can get a more readable and understandable stack trace?
We build the release like this
ns prepare ios --release --clean --env.production --env.aot --env.uglify
Then perform the archive and upload to AppStore via Xcode.
ns build android --release --clean --env.production --env.aot --env.uglify
Then upload apk to Google Play
I assume most of my issues are connected to the code being minified/uglified, but this is also the recommended way for performance, right?
ns info
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.2.3 version and is up to date.
✔ Component @nativescript/core has 8.2.5 version and is up to date.
⚠ Update available for component @nativescript/ios. Your current version is 8.2.3 and the latest available version is 8.3.0.
⚠ Update available for component @nativescript/android. Your current version is 8.2.3 and the latest available version is 8.2.4.
This is an example of a recent crash containing a stack trace from an app I'm working on. It is fairly simple to see what is causing the crash, but it's not so easy to see from where it's happening. I assume this is because of the minification process.
We can see it happens in a templateSelector (I guess that method was not minified due to being used in a template?), and that it's the accessing of the templateKey that fails, probably because the list item is null/undefined for some reason.
Luckily for us we don't have many of those, so we can go through every one, check them, log more error info and add an NPE guard to avoid the crash.
Unfortunately, this is probably one of the most descriptive error messages we've gotten.
Fatal Exception: NativeScript encountered a fatal error: Uncaught TypeError: Cannot read property 'templateKey' of undefined
at
templateSelector(file:///var/containers/Bundle/Application/E36----3B2/nsapp.app/app/bundle.js:1:290879)
at _getItemTemplate(file:///var/containers/Bundle/Application/E36----3B2/nsapp.app/app/vendor.js:2:664680)
at (file:///var/containers/Bundle/Application/E36----3B2/nsapp.app/app/vendor.js:2:667899)
0 CoreFoundation 0x99288 __exceptionPreprocess
1 libobjc.A.dylib 0x16744 objc_exception_throw
2 NativeScript 0xdbb70 tns::NativeScriptException::OnUncaughtError(v8::Local<v8::Message>, v8::Local<v8::Value>) + 63 (NativeScriptException.mm:63)
3 NativeScript 0x45a968 v8::internal::MessageHandler::ReportMessageNoExceptions(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::Object>, v8::Local<v8::Value>)
4 NativeScript 0x45a7d4 v8::internal::MessageHandler::ReportMessage(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::JSMessageObject>)
5 NativeScript 0x39b53c v8::internal::Isolate::ReportPendingMessages()
6 NativeScript 0x2f3d28 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&)
7 NativeScript 0x2f32dc v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*)
8 NativeScript 0x146780 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*)
9 NativeScript 0x1ff90 tns::ArgConverter::MethodCallback(ffi_cif*, void*, void**, void*) + 171 (ArgConverter.mm:171)
10 NativeScript 0x111264 ffi_closure_SYSV_inner
11 NativeScript 0x1141b4 .Ldo_closure
12 UIKitCore 0x2866c4 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:]
13 UIKitCore 0x483af0 -[UITableView _updateVisibleCellsForRanges:createIfNecessary:]
14 UIKitCore 0x2ab8bc -[UITableView _updateVisibleCellsNow:]
15 UIKitCore 0x17bd10 -[UITableView layoutSubviews]
16 UIKitCore 0x18bfb4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
17 QuartzCore 0x40cd0 CA::Layer::layout_if_needed(CA::Transaction*)
18 QuartzCore 0x33134 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
19 QuartzCore 0x47a7c CA::Context::commit_transaction(CA::Transaction*, double, double*)
20 QuartzCore 0x50970 CA::Transaction::commit()
21 QuartzCore 0x3288c CA::Transaction::flush_as_runloop_observer(bool)
22 UIKitCore 0x53e198 _UIApplicationFlushCATransaction
23 UIKitCore 0x7d897c _UIUpdateSequenceRun
24 UIKitCore 0xe5ec48 schedulerStepScheduledMainSection
25 UIKitCore 0xe5e410 runloopSourceCallback
26 CoreFoundation 0xbb414 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
27 CoreFoundation 0xcc1a0 __CFRunLoopDoSource0
28 CoreFoundation 0x5694 __CFRunLoopDoSources0
29 CoreFoundation 0xb05c __CFRunLoopRun
30 CoreFoundation 0x1ebc8 CFRunLoopRunSpecific
31 GraphicsServices 0x1374 GSEventRunModal
32 UIKitCore 0x514648 -[UIApplication _run]
33 UIKitCore 0x295d90 UIApplicationMain
34 NativeScript 0x114044 ffi_call_SYSV
35 NativeScript 0x110ac8 ffi_call_int
36 NativeScript 0xb39dc tns::Interop::CallFunctionInternal(tns::MethodCall&) + 1444 (Interop.mm:1444)
37 NativeScript 0x7665c std::__1::__function::__func<tns::MetadataBuilder::CFunctionCallback(v8::FunctionCallbackInfo<v8::Value> const&)::$_2, std::__1::allocator<tns::MetadataBuilder::CFunctionCallback(v8::FunctionCallbackInfo<v8::Value> const&)::$_2>, void ()>::operator()() + 849 (MetadataBuilder.mm:849)
38 NativeScript 0xd6c04 tns::Tasks::Drain() + 1739 (vector:1739)
39 NativeScript 0xd0fd0 -[NativeScript initWithConfig:] + 64 (NativeScript.mm:64)
40 nsapp 0x4c44 main + 59 (main.m:59)
41 ??? 0x102e71ce4 (Missing)
Here's a another set other reports that are flat out impossible to understand:
Fatal Exception: NativeScript encountered a fatal error: Uncaught TypeError: number 0 is not a function
at
0 CoreFoundation 0x9904c __exceptionPreprocess
1 libobjc.A.dylib 0x15f54 objc_exception_throw
2 NativeScript 0xdbb70 tns::NativeScriptException::OnUncaughtError(v8::Local<v8::Message>, v8::Local<v8::Value>) + 63 (NativeScriptException.mm:63)
3 NativeScript 0x45a968 v8::internal::MessageHandler::ReportMessageNoExceptions(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::Object>, v8::Local<v8::Value>)
4 NativeScript 0x45a7d4 v8::internal::MessageHandler::ReportMessage(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::JSMessageObject>)
5 NativeScript 0x39b53c v8::internal::Isolate::ReportPendingMessages()
Fatal Exception: NativeScript encountered a fatal error: Uncaught TypeError: number -62295433 is not a function
at
0 CoreFoundation 0x99288 __exceptionPreprocess
1 libobjc.A.dylib 0x16744 objc_exception_throw
2 NativeScript 0xdbb70 tns::NativeScriptException::OnUncaughtError(v8::Local<v8::Message>, v8::Local<v8::Value>) + 63 (NativeScriptException.mm:63)
3 NativeScript 0x45a968 v8::internal::MessageHandler::ReportMessageNoExceptions(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::Object>, v8::Local<v8::Value>)
4 NativeScript 0x45a7d4 v8::internal::MessageHandler::ReportMessage(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::JSMessageObject>)
5 NativeScript 0x39b53c v8::internal::Isolate::ReportPendingMessages()
Fatal Exception: NativeScript encountered a fatal error: Uncaught TypeError: object is not a function
at
0 CoreFoundation 0x99288 __exceptionPreprocess
1 libobjc.A.dylib 0x16744 objc_exception_throw
2 NativeScript 0xdbb70 tns::NativeScriptException::OnUncaughtError(v8::Local<v8::Message>, v8::Local<v8::Value>) + 63 (NativeScriptException.mm:63)
3 NativeScript 0x45a968 v8::internal::MessageHandler::ReportMessageNoExceptions(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::Object>, v8::Local<v8::Value>)
4 NativeScript 0x45a7d4 v8::internal::MessageHandler::ReportMessage(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::JSMessageObject>)
5 NativeScript 0x39b53c v8::internal::Isolate::ReportPendingMessages()
This one seems to come from inside NativeScript, which contains native code, so I guess this is fine to read for you guys :)
Crashed: com.apple.main-thread
0 NativeScript 0xb85e4 tns::FFICall::FFICall(tns::ParametrizedCall*) + 74 (FFICall.h:74)
1 NativeScript 0xb3894 tns::Interop::CallFunctionInternal(tns::MethodCall&) + 1383 (Interop.mm:1383)
2 NativeScript 0x1eaec tns::ArgConverter::Invoke(v8::Local<v8::Context>, objc_class*, v8::Local<v8::Object>, tns::V8Args&, tns::MethodMeta const*, bool) + 79 (ArgConverter.mm:79)
3 NativeScript 0x71658 tns::MetadataBuilder::InvokeMethod(v8::Local<v8::Context>, tns::MethodMeta const*, v8::Local<v8::Object>, tns::V8Args&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool) + 820 (MetadataBuilder.mm:820)
4 NativeScript 0x71120 tns::MetadataBuilder::PropertyGetterCallback(v8::FunctionCallbackInfo<v8::Value> const&) + 677 (MetadataBuilder.mm:677)
5 NativeScript 0x81df14 Builtins_CallApiCallback + 212
6 NativeScript 0x9020bc Builtins_LdaNamedPropertyHandler + 3132
7 NativeScript 0x81b818 Builtins_InterpreterEntryTrampoline + 248
8 NativeScript 0x81b818 Builtins_InterpreterEntryTrampoline + 248
9 NativeScript 0x81b818 Builtins_InterpreterEntryTrampoline + 248
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
该 issue 提到了 release 命令、Xcode 归档/上传流程、Google Play 上传以及多个 Crashlytics 堆栈跟踪,但没有提供任何 repository 文件或测试。先检查 iOS 和 Android 的 release 构建与 Crashlytics 报告是如何集成的,然后定义成功报告中应包含哪些源代码位置和可读的堆栈信息。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- android, ios, typescript
- 领域
- mobile-dev, observability
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100