You can configure the build to add your EUM account information so that you can automatically upload your ProGuard or DexGuard mapping files for crash reports with each build.

This is the recommended way of managing these types of mapping files, although manual modes are available for uploading mapping files. If you do not use ProGuard or DexGuard to obfuscate your files you can ignore this section. See Configure ProGuard to Prevent Obfuscation and Class Removal.

DexGuard Limitation

DexGuard mapping files must be in the default location. This means that your DexGuard configurations should not specify --printMapping, which changes where to print the mapping file.

Upload to the SaaS EUM Server

If you are using the SaaS EUM Server, provide your account name and license key to automate uploading as follows:

Specify the appropriate URL in your code to automatically upload the mapping files.

  • For SaaS, set the region's endpoint if the following conditions are true:

    • The ProGuard/Dexguard mapping files or NDK symbol files are automatically uploading to the application server during the build process.
    • Region's endpoint is different from https://api.eum-appdynamics.com (default value).

    Find the EUM API URLs for the required region from Cisco AppDynamics SaaS Domains and IP Ranges.

  • For the On-Premises EUM server, specify ON_PREM_COLLECTOR_URL.
adeum {
	url SaaS_EUM_API_URL/ ON_PREM_COLLECTOR_URL 
	//For SaaS, set the region's endpoint if the ProGuard/Dexguard mapping files or NDK symbol files are automatically uploading to the application server during the build process and region's endpoint is different from https://api.eum-appdynamics.com (default value). Find the EUM API URLs for the required region from https://docs.appdynamics.com/paa/saas-domains-and-ip-ranges.
	// For on-prem it is the public collector URL.
   account { 
		licenseKey EUM_LICENSE_KEY name EUM_ACCOUNT_NAME 
		}  symbolMappingFileUpload { 
		failBuildOnUploadFailure false 
enabled true // This specifies whether the entire build should fail if mapping file upload fails. Enabled refers to whether auto-uploading of mapping file is enabled.
		} 
	excludeClasses = ['android.support.multidex.*', 'okio.**'] // This specifies any classes customers would like to exclude from auto-instrumentation. The notation is standard java package/class specification used in Gradle.
	enabledForDebugBuilds = true // Whether auto-instrumentation is enabled for debug builds, true by default.
	enabledForReleaseBuilds = true // Whether auto-instrumentation is enabled for release builds, true by default.
	webViewCallbackCrashReportingEnabled = false // Auto-instrumentation is enabled for WebChromeClient and WebViewClient
...


// This block specifies how to handle native crashes. By default, this is not enabled.
	nativeCrashHandling {
		if (BUILD_NDKLIB) {
			enabled = true
			symbolUpload { 
				variantLibraryPaths = ["appRelease": "ndkLib/obj/local"] 
			}
		}
	}
}
JAVA

Upload to the On-Premises EUM Server

If you are using an on-premises deployment, in addition to supplying your account name and license, you must also assign the URL to your on-premises EUM Server to the url property as shown:

adeum{  
    // The account information is also needed for on-prem deployments.
    account {
      name "The EUM Account Name from the License screen"
      licenseKey "The EUM License Key from the License screen"
    }
    ...
    // Add this information to point to the on-prem EUM Server.
    url "https://<your-on-prem-eum-server>:7001"
}
TEXT

Modify the Default Upload Behavior

You can also modify the default upload behavior for both on-premises and SaaS deployments. For on-premises deployments, you will need to provide the URL to your on-premises EUM Server with the url property.

The configuration example below sets failBuildOnUploadFailure to true, so that the build will fail if the upload to the URL specified by url is unreachable. The object symbolMappingFileUpload is used for both Proguard and DexGuard mapping files. If you don't want your build to fail because the ProGuard or DexGuard mapping file couldn't be uploaded, do not modify the default setting.

adeum{  
    ...
    // Add this information to point to the on-prem EUM Server.
    url "https://<your-on-prem-eum-server>:7001"
 
   // Add this information if you want to modify upload behavior. symbolMappingFileUpload {
      failBuildOnUploadFailure true // If true, will fail build. Defaults to false.
      enabled true //enables automatic uploads.  Defaults to true
    }
}
TEXT

Configure ProGuard to Prevent Obfuscation and Class Removal

If you use ProGuard to verify or optimize your code, add the following lines to the ProGuard configuration file proguard-rules.pro under Gradle Scripts to prevent ProGuard from obfuscating or removing classes needed for proper instrumentation.

-keep class com.appdynamics.eumagent.runtime.DontObfuscate
-keep @com.appdynamics.eumagent.runtime.DontObfuscate class * { *; }
TEXT