This page provide instructions and tips for solving some common Android instrumentation issues.

Dex Failure After Upgrading Agent

If you build your application with Gradle and you get a dex failure after upgrading the Mobile Agent, you likely need to clear the Gradle cache. 

Use Android Studio

To clear the cache using Android Studio:

  1. Select Build > Clean Project.
  2. Select File > Invalidate Caches.

Sometimes a restart is also necessary.

Using the Command Line

To clear the cache using the command line:

  1. Stop Gradle.

    $ gradlew --stop
    BASH
  2. You may also need to refresh dependencies.

    $ gradlew --refresh-dependencies
    BASH

 You can also try removing the AppDynamics cached images.  

  1. Find the images.

    $ find ~/.gradle/caches -name com.appdynamics
    CODE
  2. Delete them. 

    $ find ~/.gradle/caches -name com.appdynamics -print0 | xargs -0 rm -r
    CODE

Instrumentation Appears to Be Running After Being Disabled

If you disabled the instrumentation in Android using the Gradle flag enabledForDebugBuilds, but the instrumentation task still runs, this is because of the Transform API.

Android Gradle Plugin 1.5.0 introduced the Transform API that the Android Agent uses to do the bytecode injection. Due to the limitations of the Transform API, even when instrumentation is disabled, the transformClassesWithAppDynamicsForDebug task will still appear in the Gradle task log. To ensure that it is not actually instrumenting, run gradle with --info flag to show the info logs.

 You should see the following log:

Instrumentation is disabled for this build variant. Just copying the input files to fulfill Transform contract.

Crashes Are Not Reported After Using Custom Default Uncaught Exception Handler

Install your exception handler before you start the Android Agent. When an uncaught exception is handled by the agent, it will first store the crash report, and then call your exception handler.

Network Requests Are Not Being Reported

Please see the list of supported networking libraries. If your library is not on the list, you can always report these network requests manually.

For builds with the debuggable attribute, auto-instrumentation ( the enableInstrumentation build attribute) is disabled to improve build speeds, and you cannot enable auto-instrumentation for those builds. Debuggable builds using Android Agent 20.5.0-20.7.0 do not auto-instrument network requests.

Exclude Classes from Being Instrumented

  - excludeClasses

Enforce a Different Runtime Version from the Plugin Version

  - dependencies.compile 'com.appdynamics:appdynamics-runtime:4.5.+'
    adeum.dependencyInjection.enabled = false