Prepare your application

Note: This step is only necessary for devices running Android 9 or earlier. For Android 10 devices Graphics Analyzer can use GLES layers or Vulkan validation layers to collect information from the device. You can ignore this step and go straight to Capture a trace.

To enable Graphics Analyzer to perform a trace, you need to add the Arm interceptor library to your application for devices running Android 9 or earlier. Graphics Analyzer uses this library to collect information about the graphics API calls made by your application.

If you're using Unity or Unreal Engine to build your application, follow the instructions here instead:

  1. Specify the location of the interceptor library, libAGA.so, in the module’s build.gradle file by adding the following line to the SourceSet main:
     jniLibs.srcDirs += ['<install_dir>/graphics_analyzer/target/android/arm/unrooted/']
    For example:
    sourceSets {
    main {
    manifest.srcFile 'AndroidManifest.xml'
    resources.srcDirs = ['res']
    res.srcDirs = ['res']
    assets.srcDirs = ['assets']
    java.srcDirs = ['src']
    jniLibs.srcDirs += ['/Applications/Arm_Mobile_Studio_2020.0/graphics_analyzer/target/android/arm/unrooted/']
    }
    }
    Note: Specify the unrooted directory, not the subdirectory that contains the library.
  2. Ensure that the abiFilters property in the module’s build.gradle file is set to a value that the interceptor supports; either armeabi-v7a, arm64-v8a, or both. For example:
    android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"

    defaultConfig {
    minSdkVersion 9
    targetSdkVersion 28

    ndk {
    abiFilters 'armeabi-v7a', 'arm64-v8a'
    }
    }
  3. Enable the interceptor by adding a Java component to the application to be traced to enable it to load the interceptor library. The details of this step depend on the type of application.

    For applications that use C or C++ only:
    1. Create a new Activity class that extends android.app.NativeActivity.
    2. Reference this new Activity in your AndroidManifest.xml as the android:name attribute of the activity element.
    3. Ensure that the android:hasCode attribute of the application element is set to true, otherwise the Java file will not be included in the APK.
    For applications that use Java, C/C++, or both, add the following code to the beginning of the project's main Activity class:
    static
    {
          try
          {
               System.loadLibrary("GA");
          }
          catch (UnsatisfiedLinkError e)
          {            // Feel free to remove this log message.
               Log.e("[GA]", "GA not loaded: " + e.getMessage());
               Log.d("[GA]", Log.getStackTraceString(e));
          }
    }
    Note: For more information about this step, see the Target installation section of the Graphics Analyzer User Guide.
  4. Recompile the application and install it on the target device.
Previous Next