Skip to main content

Instrument Offline Android Applications

Offline instrumenting in an Android application is a manual way to make an Android application instrumented. After you make the application instrumented with the dedicated jar file and some code changes, the application is always instrumented, even when manually opening it or after closing the reflection.

warning
  • Instrumentation must be performed before obfuscation.
  • Performing instrumentation on an already obfuscated application is not supported.
  • Applications that are obfuscated are not supported for manual or offline instrumentation.
info

Offline Instrumenting works with Android 7 and above.

In order to do offline instrumentation in Android applications, it is necessary to have the application source code.

  1. Open your application project in the Android studio.

  2. Copy the instrumentation jar file to the application project.

  3. Right-click the file, then click Add As Library. (If you do not have the instrumentation jar file, contact support@digital.ai.)
     

  4. Add to the manifest the following lines under the manifest tag (the target package should be your package name):

        <instrumentation android:targetPackage="com.experitest.uicatalog" android:name="com.experitest.android.ServerInstrumentation"/>
    ...
    <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.INTERNET"/>
  5. Build the APK.

  6. The APK now can be uploaded to cloud/STA or installed from path.

    info

    The offline-instrumented APK has to be installed non-instrumented and then launched instrumented.