Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

[Crashlytics] How can we get a better stack trace?

未關閉
#94 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
25/100
Issue 類型
功能
描述清晰度
需要釐清
活躍度
停滯
技術堆疊
android, ios, typescript

研究方向

該 issue 提到了 release 指令、Xcode 封存/上傳流程、Google Play 上傳,以及數個 Crashlytics 堆疊追蹤,但沒有提供任何 repository 檔案或測試。先檢查 iOS 和 Android 的 release 建置與 Crashlytics 報告是如何整合的,然後定義成功報告中應包含哪些原始碼位置和可讀的堆疊資訊。

由索引模型根據 Issue 內容生成。

描述

enhancement

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
主要語言
TypeScript
星號
62
分支
53
平均合併
8 天 4 小時
30 天內合併 PR
2

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

NativeScript/firebase 的其他 Issue

查看 NativeScript/firebase 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。