Page tree
Skip to end of metadata
Go to start of metadata

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

Note

Offline Instrumenting works only with Android 5.1 and up.


How to instrument Android application offline

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

Step 1: Open your application project in the Android studio.

Step 2: Copy the instrumentation jar file to the application project and "Add As Library" after right-click. (Contact Support Team for the jar file)

 

Step 3Add to the  manifest the following lines under the application 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"/>



Step 4: Build the APK 


Step 5: Install the app non-instrumented (with instrument = false), before launching the app instrumented set the property "android.offline.instrumentation" using the setProperty command  

    @Test
    public void offlineInstrumentationTest(){
        client.setDevice("adb:Pixel 4a");
        client.setProperty("android.offline.instrumentation", "true");
        client.install("C:\\Users\\ahmad.sabbah\\StudioProjects\\ios\\UIcatalogAndroid\\app\\build\\outputs\\apk\\debug\\UICatalog.apk", false, false));
        client.launch("com.experitest.uicatalog/.MainActivity", true, true);
        client.setProperty("android.offline.instrumentation", "false");
    }



for now offline Instrumentation -  should work on STA, Grid




  • No labels