Modify the Source

  1. In the source file that defines your application's primary Activity, add the following import:
    import com.appdynamics.eumagent.runtime.Instrumentation;
  2. In your primary Activity's onCreate() method, add the following lines, passing in the EUM App Key from Step 2 above:
    Instrumentation.start(<EUM_APP_KEY>, getApplicationContext());
  3. Save the file. Your code should look something like this:
    import com.appdynamics.eumagent.runtime.Instrumentation;
    ...
    @Override public void onCreate(Bundle savedInstanceState) {
      Instrumentation.start(<EUM_APP_KEY>, getApplicationContext());
      ...
    }
  4. Configure the Android Agent to report metrics and screenshots to the SaaS EUM Server and Screenshot Service in your region when initializing the agent with the methods withCollectorURL and withScreenshotURL. (If you are using an on-premises EUM Server, see Customize the Agent Configuration for implementation details.)
    import com.appdynamics.eumagent.runtime.Instrumentation;
    ...
    @Override public void onCreate(Bundle savedInstanceState) {
      Instrumentation.start(AgentConfiguration.builder()
        .withAppKey("<EUM_APP_KEY>")
        .withContext(getApplicationContext())
        // The default SaaS EUM Server and Screenshot Service are in the Americas, 
        // so you can omit the following settings if you are in the Americas.
        .withCollectorURL("https://<your_region>-col.eum-appdynamics.com")
        .withScreenshotURL("https://<your_region>-image.eum-appdynamics.com/")
        .build());
      ...
    }
  5. In your module-level build.gradle file, add your Splunk AppDynamics account information as configurations in the adeum snippet. If you complete this step in the Getting Started Wizard, the configurations will populate in the UI code snippet. If you cannot get the EUM App Key from the Getting Started Wizard, see Access Browser Monitoring Configuration.
    dependencies {
    implementation 'com.appdynamics:appdynamics-runtime:<latest version>'
    // This line is added for Splunk AppDynamics.
    }
    adeum { // This section is added for Splunk AppDynamics.
    account {
    name '<account name>'
    licenseKey '<key>'
    }
    1. If you are using Android Studio, you need to add a build script block to the top of your project's build.gradle file:
      // project level build.gradle
      
      buildscript {
        dependencies{
            classpath("com.appdynamics:appdynamics-gradle-plugin:<latest-version>")}
      
        repositories {
          mavenCentral()
        }
      }
      Alternatively, you can use the plugin block and define the resolutionStrategy block in the settings.gradle file:
      // project level build.gradle
      plugins{
      id 'com.appdynamics.appdynamics-gradle-plugin' version<version>
      }
      // settings.gradle
      repositories{
      gradlePluginPortal()
      mavenCentral()
      }
      resolutionStrategy {
      eachPlugin {
      plugin
      -> if (plugin.requested.id.id
      == "com.appdynamics.appdynamics-gradle-plugin") {
      useModule("com.appdynamics:appdynamics-gradle-plugin:<latest-version>")
      }
      }
      }