Bewerken

Share via


Android NDK

Important

Visual Studio App Center is scheduled for retirement on March 31, 2025. While you can continue to use Visual Studio App Center until it is fully retired, there are several recommended alternatives that you may consider migrating to.

Learn more about support timelines and alternatives.

Android NDK allows you to implement parts of your Android apps using C and C++. You can use the Google Breakpad client library for your Android apps to receive valid stack traces in native code. The stack traces may only contain memory addresses. They don’t show class names, methods, file names, and line numbers which are needed to read and understand the crashes. To get the memory addresses translated for your Android NDK app, you must upload application symbols for each build.

To learn how to report NDK crashes, refer to the Android SDK documentation for Android apps, or Unity SDK documentation for Unity apps.

If you want to send Breakpad crashes from other platforms to App Center, see the upload custom crashes documentation.

Unsymbolicated crashes

Unsymbolicated crashes are displayed in the App Center Diagnostics section so you can view some details even before uploading symbols. The missing symbols from these crashes will be shown in the "unsymbolicated" tab. If the missing symbols are uploaded, the unsymbolicated crash group will be replaced by a symbolicated crash group.

Note

App Center doesn't support symbolication of frames which come from system libraries. Given the high fragmentation of system binaries for Android and other platforms – which might be different on any given device/OS version combination – App Center doesn't provide symbols itself for system binaries and automatically skips frames from system binaries in symbolication.

Generate a .zip file to upload

There are two ways for App Center to retrieve the symbols necessary for symbolication. App Center can generate them from the native binaries used in your project, or you can upload the Breakpad symbols directly.

Option 1: Upload native binaries

Put all .so files from the project's obj/local/$ABI/ directory into a .zip file.

Option 2: Upload Breakpad symbols

  1. Dump the symbols using the Breakpad toolchain as described in the Breakpad documentation under section "Get the debugging symbols".
  2. Create a symbols.zip file with the following structure:

Note

If you're uploading your symbols from macOS, then you must clean your symbols of any extraneous folders, e.g. __MACOS gets generated and to delete this you can use zip -d <symbols.zip> __MACOSX/\*.

$ unzip -l symbols.zip
Archive:  symbols.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
        0  07-22-13 15:07   symbols/
        0  07-22-13 15:07   symbols/libnative.so/
        0  07-22-13 15:07   symbols/libnative.so/EAC901FB6DDCCE8AED89E1A8E4A58360/
    12468  07-22-13 15:07   symbols/libnative.so/EAC901FB6DDCCE8AED89E1A8E4A58360/libnative.so.sym
        0  07-22-13 15:07   symbols/libnative.so/FDC5C9E715C4F16408C0B78F95855BF0/
    12467  07-22-13 15:07   symbols/libnative.so/FDC5C9E715C4F16408C0B78F95855BF0/libnative.so.sym
 --------                   -------
    24935                   6 files

Uploading symbols

Note

The App Center Build and Distribution service can automatically forward symbols to the Diagnostics service. If you use App Center to build and auto distribute your app to your end users, you don't need to manually obtain and upload the symbol files as detailed in the steps below.

App Center Portal

  1. Log into App Center and select your app.
  2. In the left menu, navigate to the Diagnostics section, then Issues.
  3. If your application hasn't reported any crash yet, you'll need to use the API or CLI to upload Breakpad symbols.
  4. If your application already has reported crashes that need symbols, check the Unsymbolicated tab and there should be a version group with missing symbols, click on it to reveal the menu to upload the file.
  5. After the symbols are indexed by App Center, crashes will be symbolicated for you.

App Center API

The process for uploading symbols through the API involves a series of three API calls: one to allocate space on our backend, one to upload the file, and one to update the status of the upload. The body of the first API call should set symbol_type to Breakpad.

  1. Trigger a POST request to the symbol_uploads API. This call allocates space on our backend for your file and returns a symbol_upload_id and an upload_url property.
curl -X POST 'https://api.appcenter.ms/v0.1/apps/{owner_name}/{app_name}/symbol_uploads' \
    -H 'accept: application/json' \
    -H 'X-API-Token: {API TOKEN}' \
    -H 'Content-Type: application/json' \
    -d '{JSON BODY}'
  1. Using the upload_url property returned from the first step, make a PUT request with the header: "x-ms-blob-type: BlockBlob" and supply the location of your file on disk. This call uploads the file to our backend storage accounts. Learn more about PUT Blob request headers .
curl -X PUT '{upload_url}' \
    -H 'x-ms-blob-type: BlockBlob' \
    --upload-file '{path to file}'
  1. Make a PATCH request to the symbol_uploads API using the symbol_upload_id property returned from the first step. In the body of the request, specify whether you want to set the status of the upload to committed (successfully completed) the upload process, or aborted (unsuccessfully completed).
curl -X PATCH 'https://api.appcenter.ms/v0.1/apps/{owner_name}/{app_name}/symbol_uploads/{symbol_upload_id}' \
    -H 'accept: application/json' \
    -H 'X-API-Token: {API TOKEN}' \
    -H 'Content-Type: application/json' \
    -d '{ "status": "committed" }'

Note

The symbol uploads API doesn't work for files that are larger than 256MB. Use the App Center CLI to upload these files. You can install the App Center CLI by following the instructions in our App Center CLI repo.

App Center CLI

You can also use the CLI to upload symbol files:

appcenter crashes upload-symbols --breakpad {symbols file}

Ignoring symbols

When App Center doesn't have all the symbol files to fully symbolicate crash reports, the crashes are listed in the Unsymbolicated tab. The required symbols are uploaded from this page if you have access to them.

If you can't upload the symbols, you can mark them as Ignored by selecting rows in the table and clicking the Ignore versions button. This button tells App Center to process the crashes and symbolicate them as fully as possible with the symbols on file. Once they've finished processing, they'll appear in the Crashes tab partially symbolicated. New crashes that also depend on those same symbol IDs marked as ignored will bypass the Unsymbolicated tab as they come in and flow through the system.