且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android libc.so 崩溃?

更新时间:2023-02-02 21:40:31

您应该使用 addr2line 工具,如here 并在您的库中查找这两个地址以查找导致崩溃的原因:

You should use addr2line tool as described here and lookup these two addresses in your library to find what causes the crash:

#02  pc 00026558  /data/data/com.prattia.webs.testgfx5/lib/libandenginephysicsbox2dextension.so
#03  pc 00013e7c  /data/data/com.prattia.webs.testgfx5/lib/libandenginephysicsbox2dextension.so

所以在 Windows 下你应该:

So under Windows you should:

  1. 从设备复制库:

  1. Copy the library from device:

adb pull /data/data/com.prattia.webs.testgfx5/lib/libandenginephysicsbox2dextension.so C:

  • 使用命令行为其运行 addr2line 工具:

    cd %PATH_TO_YOUR_NDK%	oolchainsarm-linux-androideabi-4.4.3prebuiltlinux-x86in
    arm-linux-androideabi-addr2line -C -f -e C:libandenginephysicsbox2dextension.so
    

  • 按地址输入地址:

  • Enter adress by adress:

    00026558 [ENTER]
    > here will be function name and line
    00013e7c [ENTER]
    > and again
    

  • 注意:在 Windows 下运行此工具可能会比在 Linux 下提供更少的信息,因此您可以选择将发行版安装为虚拟机并按照上面原始答案链接中的说明进行操作.

    Note: running this tool under Windows may give you less information than under Linux, so you may choose to install the distro as a virtual machine and follow instructions from the link to original answer above.

    另一种(更简单的?)方法是使用 ndk-stack:

    Another (easier?) way is to use ndk-stack:

    1. 和以前一样
    2. 将您的转储保存到文件中.我们称之为dump.txt".
    3. 运行ndk-stack:

    cd %PATH_TO_YOUR_NDK%
    ndk-stack -sym C:libandenginephysicsbox2dextension.so -dump C:dump.txt