On this page:

Related pages:

Your Rating:
Results:
PatheticBadOKGoodOutstanding!
17 rates

If you have obfuscated your code and want to monitor crashes, you will need to upload the ProGuard or DexGuard mapping files. AppDynamics needs the mapping file for the application to produce human-readable stack traces for crash snapshots. For details about why you should do this, see Get Human-Readable Crash Snapshots

DexGuard is built on ProGuard, so the Controller UI and some of the REST API for uploading mapping files will refer to ProGuard for both ProGuard and DexGuard files. 

The sections below discuss the requirements, the available methods, and instructions for manually uploading the mapping files.

It is highly recommended to set up automatic uploading of the ProGuard or DexGuard mapping files using Gradle and your build.gradle file. 

Requirements

To manually upload the mapping files, you need to associate the mapping file with the correct version of the application by providing the following:

  • the package name of the Android package for the application
  • the version code for that application specified in either the AndroidManifest.xml file or the build.gradle file

Upload Methods

You can then either upload the mapping file using the Upload missing ProGuard Mappings dialog in the Controller UI or use a special REST API. Perform the upload separately for each ProGuard mapping file that you are providing. You can also check your uploads with a separate REST API.

If you update your application, you need to upload the new version of the mapping file.

Upload with the Controller UI

  1. From the Mobile App menu, click Configuration.
  2. Click ProGuard Mappings >.
  3. From the Upload missing ProGuard Mapping dialog:
    1. Enter the version code (a number) for the package. This is the versionCode property specified in either the  AndroidManifest.xml file or the build.gradle file of the application for which this mapping file was generated.
    2. Click Choose File.
      The uploader expects a file with the .txt extension. The file is named mapping.txt.
    3. In the file browser, locate and select the mapping file and click Open.
    4. Click Upload.

Upload with the API

The API uses HTTP basic authentication. The username is your AppDynamics EUM account name and the password is your EUM license key.

Send the mapping file

Send the mapping file as a text file in the body of the PUT request to the following URL:

https://api.eum-appdynamics.com/v2/account/<MyAccountName>/<androidPackageName>/<versionCode>/mapping-file


These parameters are required:

  • MyAccountName: the URL-encoded version of your account name.
  • androidPackagename: the name of the Android package for which this mapping file was generated.
  • versionCode: the string representation of the "versionCode" property specified in either the  AndroidManifest.xml file or the build.gradle file of the application for which this mapping file was generated. 

The request body contains the mapping file. You need to add a Content-Type header, -H Content-Type:text/plain, and your account name and license key/password to the call. 

Sample Request and Response Using the REST API

This is a sample request and response using the REST API. 

Upload Request

The following example uses curl to send a ProGuard mapping file. You would use a similar command to send a DexGuard mapping file. The account name is "Example account" and the license key/password is "Example-License-Key-4e8ec2ae6cfe". The plus signs replace spaces in the account name when the account name is URL-encoded. The package name of the Android application is "com.example.networklogger". The mapping file corresponds to the version with versionCode.

curl -v -H Content-Type:text/plain --upload-file mapping.txt --user Example+account:Example-License-Key-4e8ec2ae6cfe https://api.eum-appdynamics.com/v2/account/Example+account/com.example.networklogger/1/mapping-file 
Upload Response 

The successful output of the example request looks like this:

* About to connect() to api.eum-appdynamics.com port 443 (#0)
*   Trying ::1...
* connected
* Connected to api.eum-appdynamics.com  (::1) port 443 (#0)
* Server auth using Basic with user 'Example+account'
> PUT /v2/account/Example+account/com.example.networklogger/1/proguard-mapping HTTP/1.1
> Authorization: Basic SW50ZXJuYWwrdGVzdCthY2NvdW50OlRlc3RBY2N0LTFlMzktNDVkMy05MzAzLTRlOGVjMmFlNmNmZQ==
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5
> Host: app.eum-appdynamics.com
> Accept: */*
> Content-Length: 4
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Content-Length: 0
< Server: Jetty(8.1.4.v20120524)
<
* Connection #0 to host app.eum-appdynamics.com left intact
* Closing connection #0

Check Uploaded Mapping Files Using the REST API 

You can check to make sure that your mapping files have successfully uploaded using two REST APIs.

  1. Get a list of the GUIDs for the last 50 mapping files you have uploaded.
  2. Check if a specific mapping file has been uploaded.

List of the last 50 mapping files uploaded

The proguardQuery method allows you to retrieve a list of GUIDs for up to the last 50 mapping files (ProGuard or DexGuard) that have been uploaded to your account, along with the time they were uploaded. The response is displayed as JSON, by upload time, with the most recent first.

  1. Set up your authentication as described in Upload with the API.

  2. Create a GET request of the form: 

    curl --user Example+account:Example-License-Key-4e8ec2ae6cfe https://<EUM_Cloud/EUM_Server_Host:port>/v2/account/<EUM_Account_Name>/crash-symbol-file-query/mapping-file


    where the value for --user is the authentication string you created in step 1, EUM_Cloud refers to api.eum-appdynamics.com:443 for SaaS-based EUM Cloud accounts or EUM_Server_Host, which refers to the URL where your on-premises EUM Server is hosted, and EUM_Account_Name is your EUM account name.

Sample Request  
curl --user Example+account:Example-License-Key-4e8ec2ae6cfe  https://api.eum-appdynamics.com:443/v2/account/<EUM_Account_Name>/crash-symbol-file-query/mapping-file

Sample Response
{"proguardFiles": [
{"packageName":"my_package_name1", "version":"1", "uploadTime":"mm/dd/yyyy 16:09:23","GUID":"my_build_id1"}, 
{"packageName":"my_package_name2", "version":"1", "uploadTime":"mm/dd/yyyy 16:09:23","GUID":"my_build_id2"}
]}

Check for specific mapping file by GUID 

The checkForProguardFile method allows you to check if a specific ProGuard or DexGuard file by GUID has been uploaded. The upload time is returned in the response.

    1. Set up your authentication as described in Upload with the REST API.
    2. Create a GET request of the form:

      curl --user Example+account:Example-License-Key-4e8ec2ae6cfe https://<EUM_Cloud/EUM_Server_Host:port>/v2/account/<EUM_Account_Name>/crash-symbol-file-query/mapping-file/guid/<GUID_To_Check>

      where the value for --user is the authentication string you created in step 1, EUM_Cloud refers to api.eum-appdynamics.com:443 for SaaS-based EUM Cloud accounts or EUM_Server_Host refers to the URL pointing to your on-premises EUM Server, EUM_Account_Name is your EUM account name and GUID_To_Check is the GUID of the ProGuard file in which you are interested.

      Sample Request
      curl --user Example+account:Example-License-Key-4e8ec2ae6cfe  https://api.eum-appdynamics.com:443/v2/account/<EUM_Account_Name>/crash-symbol-file-query/mapping-file/guid/my_build_id1
      Sample Response
      {"packageName":"mypackagename","version":"1","uploadTime":"mm/dd/yyyy 16:09:23","GUID":"my_build_id1"}