Tencent Bugly Android symbol table configuration and upload

introduce

What is a symbol table?

The symbol table is a mapping table of memory addresses and function names, file names, and line numbers. The symbol table elements are as follows:

<起始地址> <结束地址> <函数> [<文件名:行号>]

Why configure the symbol table?

In order to quickly and accurately locate the code location where the user's APP crashes, Bugly uses the symbol table to analyze and restore the program stack where the APP crashes.

As an example:

Bugly provides automatic and manual methods to configure the Android symbol table.

Automatic Configuration: Using the Android Studio Plugin

The Bugly plug-in has the function of uploading symbol table files, and supports JCenter warehouse and Maven Central warehouse .

Plug-in configuration and usage reference documentation: Bugly Symbol Table Plug-in Usage Guide

manual configuration

The manual configuration process is as follows:

  • Download the latest version of the Bugly Android symbol table tool , which includes:

    • Symbol table tool JAR package (buglySymbolAndroid.jar)
    • Windows script (buglySymbolAndroid.bat)
    • Shell script (buglySymbolAndroid.sh)
    • Default symbol table configuration file (settings.txt)
    • Symbol Table Tool for Android - User Guide
  • Locate Debug SO files by UUID

  • Use tools to generate symbol table files (zip files)

  • Upload the symbol table file on the page

other instructions

  • If the project only uses obfuscated code (Proguard) but no Native project, you only need to directly upload the Mapping file generated by Proguard;

  • Bugly Android symbol table tool version 2.5.0 and above adds the upload function and supports the upload of Mapping files;

  • For the method of locating the Debug SO file and the method of using the tool, please refer to: "Symbol Table Tool for Android - User Guide".

Symbol table upload interface

Bugly provides an API interface for uploading symbol tables (upload using POST):

  • https://api.bugly.qq.com/openapi/file/upload/symbol

Parameter Description

The parameters of the upload interface are described as follows:

Attributes illustrate
api_version API version, fixed to 1
app_id App ID
app_key App Key
symbolType Symbol table type, Mapping is 1, Symbol is 3
bundleId Package name (Package)
productVersion Version number (Version Name)
channel channel
fileName symbol table filename
file symbol table file

Among them, the package name, version number, channel and symbol table file name need to be URL Encoded.

Example: Uploading with Curl

An example of using the Curl tool to upload is as follows:

  • Upload Mapping file
curl -k "https://api.bugly.qq.com/openapi/file/upload/symbol?app_key=xxx&app_id=9000xxx" --form "api_version=1" --form "app_id=xxxxxx" --form "app_key=xxxxxx" --form "symbolType=1"  --form "bundleId=com.demo.test" --form "productVersion=1.0" --form "channel=xxx" --form "fileName=mapping.txt" --form "[email protected]" --verbose
  • Upload the symbol table file (Symbol file)
curl -k "https://api.bugly.qq.com/openapi/file/upload/symbol?app_key=xxx&app_id=9000xxx" --form "api_version=1" --form "app_id=xxxxxx" --form "app_key=xxxxxx" --form "symbolType=3"  --form "bundleId=com.demo.test" --form "productVersion=1.0" --form "fileName=symbol.zip" --form "[email protected]" --verbose

Debug SO statement

What are Debug SO files?

On the Android platform, the target file corresponds to the SO file. Debug SO files refer to SO files with debugging information.

为了方便找回Crash对应的Debug SO文件和还原堆栈,建议每次构建或者发布APP版本的时候,备份好Debug SO文件。

How to locate Debug SO files?

IDE: Eclipse

If the IDE uses Eclipse+NDK, by default, the Debug SO file will be located at: <项目文件夹>/obj/local/<架构(Architecture)>/

As shown below:

IDE: Android Sutdio

If the IDE uses Android Studio+NDK, by default, the Debug SO file compiled by Debug will be located at: <项目文件夹>/<Module>/build/intermediates/ndk/debug/obj/local<架构>/

And the Debug SO file compiled by Release will be located at: <项目文件夹>/<Module>/build/intermediates/ndk/release/obj/local<架构>/

As shown below:

How to judge whether it matches Crash?

Bugly v2.0 page

When Bugly v1.0 restores the Crash stack, it matches the symbol table file according to the App package name, App version number, SO file name and architecture.

  • How to upload using the tool

    • Check whether the SO file name and architecture entered when generating the symbol table file match the SO file of the Crash stack;

    • Check whether the app package name and version number specified during upload match the app package name and version number corresponding to Crash.

  • Manual upload method

    • Check whether the SO file name and architecture entered when generating the symbol table file match the SO file of the Crash stack;

    • On the version management page, check whether the symbol table file is uploaded under the App version (package name and version) corresponding to Crash.

Bugly v2.0 page

When Bugly v2.0 restores the Crash stack, it needs to match the symbol table file according to the UUID, so the stack can be restored accurately only when the UUID of the uploaded symbol table file is consistent with the UUID of the SO file of the Crash stack.

How to check UUID of Debug SO file?

The UUID of the symbol table file is consistent with the UUID of the Debug SO file, so you can view the UUID of the Debug SO file through the symbol table file generated by the symbol table tool:

生成符号表文件(.zip) ---> 解压符号表文件(.symbol) ---> 使用文本编辑器打开符号表文件

The "SHA-1" information of the symbol table file is the UUID of the Debug SO file, which is also the UUID of the symbol table file. If the file is large, it is recommended to use a text editor such as "Sublime Text" to open the symbol table file.

由于Bugly v2.0已采用新的UUID计算规则,为了能正确地匹配Crash堆栈对应的SO文件,请使用2.5.0或以上版本的符号表工具。

Can't find the Debug SO file corresponding to Crash?

If the symbol table file or Debug SO file corresponding to Crash cannot be found locally, but the Native project code of the APP version corresponding to Crash can still be retrieved, it is recommended to try to recompile the Debug SO file with NDK and use the symbol table tool to generate a symbol table file .

If even the Native project code cannot be retrieved, it is really impossible to restore the Crash stack.

In order to prevent this situation, it is recommended to back up the Debug SO file every time you build or release the APP version!

After success, the background is as shown in the figure:

 

For detailed documentation, please refer to: home - Bugly Documentation

https://bugly.qq.com/docs/user-guide/symbol-configuration-android/?v=20170912151050

Welcome to leave a message below to discuss, or join the QQ group 769397359 to communicate!

Guess you like

Origin blog.csdn.net/u013007305/article/details/79669186