For apps that use the NDK, native stacktraces from C or C++ code consist of a list of addresses and numeric offsets. BugSnag requires a mapping file to be uploaded to match a given address with a file name and method.
For installation instructions for the BugSnag CLI, please see our Installation guide.
The android-ndk
command takes your built .so
files and extracts symbol mapping information using the objcopy
tool in your NDK installation. This removes all executable code and just leaves the symbol information for upload to the NDK symbol API.
In addition to the symbol file, the command extracts version and build information, including your BugSnag API key, from your app’s manifest file (AndroidManifest.xml
). The command attempts to find a merged app manifest file in your project directory, but if you have a non-standard project layout the location can be specified using the --app-manifest
option, along with --variant
if multiple build flavors exist. All values read from the app manifest can be overridden, or provided entirely, using the --application-id
, --version-name
and --version-code
options.
The simplest way to run the command is from the root directory of your Android project:
$ bugsnag-cli upload android-ndk
Or by providing a specific library to upload:
$ bugsnag-cli upload android-ndk \
app/build/intermediates/merged_native_libs/release/out/lib/arm64-v8a/libMyApp.so
If your build contains multiple variants or has a non-standard project layout, you might need to provide extra options:
$ bugsnag-cli upload android-ndk \
--variant=release \
--app-manifest-path=app/build/intermediates/merged_manifests/release/AndroidManifest.xml
--android-ndk-root
)The path to your NDK installation, used to access the objcopy tool for extracting symbol information.
Default: the path in the $ANDROID_NDK_ROOT
environment variable.
--api-key
)The BugSnag API key for the application.
You can find your API key in Project Settings from your BugSnag dashboard.
Default: the value of com.bugsnag.android.API_KEY
in your app’s manifest file, if found.
--app-manifest
)The path to a manifest file (AndroidManifest.xml) from which to obtain build information.
Default: the path app/build/intermediates/merged_manifests/<variant>/AndroidManifest.xml
from your project directory.
--application-id
)A unique application ID, usually the package name, of the application.
Default: the value of Package
in your app’s manifest file, if found.
--dry-run
)Performs a dry-run of the command without sending any information to BugSnag.
--fail-on-upload-error
)Stops the upload when a file fails to upload successfully.
--log-level
)Sets the level of logging to debug, info, warn or fatal.
Default: info
.
--overwrite
)Whether to ignore and overwrite existing uploads with same identifier, rather than failing if a matching file exists.
--port
)The port number for the BugSnag upload server.
Default: 443
.
--project-root
)The path to strip from the beginning of source file names referenced in stacktraces on the BugSnag dashboard.
Default: the root directory if the command has detected one, otherwise it’s empty.
--retries
)The number of retry attempts before failing an upload request.
Default: 0
.
--timeout
)The number of seconds to wait before failing an upload request.
Default: 300
.
--upload-api-root-url
)The upload server hostname, optionally containing port number.
For use in BugSnag On-premise configurations. The command will append the appropriate path to access the correct upload endpoint.
Default: https://upload.bugsnag.com
.
--variant
)The build type/flavor (e.g. debug, release) used to disambiguate the between built files when searching the project directory.
--verbose
)Sets the level of the logging to its highest.
This is the equivalent of setting the log level to debug
.
--version-code
)The version code of this build of the application.
Default: the value of VersionCode
in your app’s manifest file, if found.
--version-name
)The version of the application.
Default: the value of VersionName
in your app’s manifest file, if found.