如何使用本机 (C++) 符号在调试模式下构建 Android React Native 源代码? [英] How to build Android React Native source code in debug mode with native (C++) symbols?

查看:72
本文介绍了如何使用本机 (C++) 符号在调试模式下构建 Android React Native 源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想构建带有调试本机代码(Java 和 C++)选项的 React-Native 代码,到目前为止我所做的:

  1. 克隆 react-native 源代码
  2. NDK_DEBUG=1 添加到 buildReactNdkLib gradle 任务 -

    I want to build the React-Native code with the option to debug native code (Java & C++), what I did till now:

    1. Clone react-native source code
    2. Added NDK_DEBUG=1 to buildReactNdkLib gradle task - code
    3. I had to add some files to the make file of the folly project - code
    4. I added the command not to stip the .so files in one of the makefiles - code - actually I was sure that NDK_DEBUG=1 is doing this by default, but it wasn't

    The result is that the build is passing and the so files are really not-stripped, but the app crashes in Runtime

    2019-04-06 11:24:31.058 24906-24906/? A/DEBUG: pid: 24850, tid: 24890, name: mqt_js  >>> com.facebook.react.uiapp <<<
    2019-04-06 11:24:31.058 24906-24906/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
    2019-04-06 11:24:31.059 24906-24906/? A/DEBUG: Abort message: 'java_vm_ext.cc:504] JNI DETECTED ERROR IN APPLICATION: JNI GetObjectRefType called with pending exception com.facebook.react.uimanager.IllegalViewOperationException: No ViewManager defined for class Text'
    2019-04-06 11:24:31.059 24906-24906/? A/DEBUG:     eax 00000000  ebx 00006112  ecx 0000613a  edx 00000006
    2019-04-06 11:24:31.059 24906-24906/? A/DEBUG:     esi 0000613a  edi 878553d8
    2019-04-06 11:24:31.059 24906-24906/? A/DEBUG:     xcs 00000073  xds 0000007b  xes 0000007b  xfs 0000003b  xss 0000007b
    2019-04-06 11:24:31.059 24906-24906/? A/DEBUG:     eip ad1d7ac4  ebp 878553f8  esp 8785538c  flags 00000296
    2019-04-06 11:24:31.070 24906-24906/? A/DEBUG: backtrace:
    2019-04-06 11:24:31.070 24906-24906/? A/DEBUG:     #00 pc 00000ac4  [vdso:ad1d7000] (__kernel_vsyscall+16)
    2019-04-06 11:24:31.070 24906-24906/? A/DEBUG:     #01 pc 00075b3c  /system/lib/libc.so (tgkill+28)
    2019-04-06 11:24:31.070 24906-24906/? A/DEBUG:     #02 pc 0001f04e  /system/lib/libc.so (abort+110)
    2019-04-06 11:24:31.070 24906-24906/? A/DEBUG:     #03 pc 0053bcbd  /system/lib/libart.so (_ZN3art7Runtime5AbortEPKc+669)
    2019-04-06 11:24:31.070 24906-24906/? A/DEBUG:     #04 pc 0053c599  /system/lib/libart.so (_ZN3art7Runtime7AborterEPKc+41)
    2019-04-06 11:24:31.070 24906-24906/? A/DEBUG:     #05 pc 0011c3d3  /system/lib/libart.so (_ZNSt3__110__function6__funcIPFvPKcENS_9allocatorIS5_EES4_EclEOS3_+35)
    2019-04-06 11:24:31.070 24906-24906/? A/DEBUG:     #06 pc 0065168a  /system/lib/libart.so (_ZN7android4base10LogMessageD1Ev+1034)
    2019-04-06 11:24:31.070 24906-24906/? A/DEBUG:     #07 pc 00386952  /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+2146)
    2019-04-06 11:24:31.071 24906-24906/? A/DEBUG:     #08 pc 00386bd1  /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_Pc+113)
    2019-04-06 11:24:31.071 24906-24906/? A/DEBUG:     #09 pc 0014ec45  /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+69)
    2019-04-06 11:24:31.072 24906-24906/? A/DEBUG:     #10 pc 0014e710  /system/lib/libart.so (_ZN3art11ScopedCheck11CheckThreadEP7_JNIEnv+544)
    2019-04-06 11:24:31.072 24906-24906/? A/DEBUG:     #11 pc 0014d311  /system/lib/libart.so (_ZN3art11ScopedCheck22CheckPossibleHeapValueERNS_18ScopedObjectAccessEcNS_12JniValueTypeE+161)
    2019-04-06 11:24:31.072 24906-24906/? A/DEBUG:     #12 pc 0014c8b3  /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE+1155)
    2019-04-06 11:24:31.072 24906-24906/? A/DEBUG:     #13 pc 0014bf36  /system/lib/libart.so (_ZN3art8CheckJNI16GetObjectRefTypeEP7_JNIEnvP8_jobject+998)
    2019-04-06 11:24:31.072 24906-24906/? A/DEBUG:     #14 pc 000e2fce  /data/app/com.facebook.react.uiapp-uUhqD6BXzpF-7FnHQHBjIA==/lib/x86/libreactnativejni.so (_ZN7_JNIEnv16GetObjectRefTypeEP8_jobject+62)

    解决方案

    Just found the answer, I don't need set NDK_DEBUG=1, all the not-stripped files placed under build/tmp/buildReactNdkLib/local//

    You just need to configure the symbol directory in Android-Studio:

    这篇关于如何使用本机 (C++) 符号在调试模式下构建 Android React Native 源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆