Android Apps| Ranorex Help Center
Help CenterUser GuideInterfaces and connectivity

Android apps

In this chapter, you’ll learn how to instrument an Android app.

tipp icon


For Android developers: As part of the instrumentation process, the app will be compiled with the Ranorex automation library. This library adds additional functions and permissions to your APK. This is why we recommend you do NOT publish instrumented apps to Google Play.

In this chapter


    Before you can instrument and deploy an app for automation with Ranorex, complete the following preparations:

    Prepare the app

    Make sure you can access the APK from the computer on which Ranorex Studio is installed. We recommend that you store a copy of the APK in a folder on that computer.

    Prepare the mobile device

    • Apply the ⇢ device settings.
    • ⇢ Connect your device to the computer on which Ranorex Studio is installed.
    • Start the Ranorex Service App on the device.
    Note icon


    You can instrument and then immediately deploy the app to your mobile device with the Instrumentation Wizard. If you want to do so, you must connect the mobile device to your computer via USB (recommended).

    Instrumentation example

    For our example, we’ll instrument the Dropbox app. The app is a product of Dropbox, Inc, whose terms and conditions for downloading and using the app apply. 

    In preparation for instrumentation, we’ve stored the app in the folder Android app testing on the computer Ranorex Studio is installed on.

    Select technology

    Start the Instrumentation Wizard and confirm the Windows security dialog.

    Click Android.

    Click Next.

    Specify APK and settings

    Click Browse…

    Browse to the folder that contains the APK.

    The APK appears in the Instrumentation Wizard.

    Click Settings… if you want to apply advanced settings. These are explained at the end of this page under Advanced Android instrumentation settings.

    Default settings for instrumenting the app.

    Default settings for deploying the app after instrumentation.

    Select mobile device


    Select a mobile device from the list of available devices or
    Open the endpoint list to select a mobile device.

    Start instrumentation and deployment

    Click Next > to start the instrumentation process.

    Watch it progress. It can take several minutes.

    The app has been instrumented successfully.

    Note icon


    If the process fails, please first check you’ve applied the ⇢ device settings correctly and ⇢ connected the device properly. A common problem is also that another program is consuming too many resources, slowing down instrumentation to the point of a timeout error. Either close all other programs or increase the Instrumentation timeout in the settings.


    If the app has been instrumented and deployed correctly, you will see the following on your device:

    The instrumented app appears in the Ranorex Service App.

    The instrumented app appears on your device’s homescreen.

    In Ranorex Studio, you can see the app has been instrumented correctly if it appears for selection when creating a mobile test.

    Advanced Android instrumentation settings

    These settings are available as part of the instrumentation dialog, as explained on this page under Specify APK and settings. They contain options for configuring instrumentation for special types of Android apps and are also useful for troubleshooting.

    AndroidManifest.xml addon settings

    Custom package name: Allows you to specify a custom class name for locating resource IDs (e.g. com.ranorex.demo.R). By default, Ranorex Studio will search for IDs in <manifestpackage>.R.

    Enable web testing: When set to true (default), shows DOM content of WebViews in the UI element tree in Ranorex Spy. Has a significant performance impact.

    Full image comparison: When set to true, uses a more robust image comparison mechanism to determine resource IDs for images. Decreases startup performance.

    Tree simplification: When set to false, no postprocessing of the UI element tree takes place. This means a more complex element tree is displayed in Ranorex Spy, which may be useful for automating third-party Android controls.

    Instrumentation options

    Avoid resources decompiling: If set to ‘True’ (=default), resources are not decompiled and recompiled during instrumentation. This means that:

    • Resources won’t be decompiled and the arsc is kept intact without any decoding.
    • The AndroidManifest.xml is decoded by Ranorex Studio and not by the default Android tools embedded in the apk.

    When enabled, speeds up the instrumentation process significantly. Only set to ‘False’ if you need to make changes to the resources in the instrumented APK.

    Debug information: When set to true, adds additional information to the instrumentation log file. Useful for troubleshooting instrumentation issues.

    Multidex application: If your mobile app and the libraries it references exceed 65,536 methods and this option is set to ‘False’, you will encounter a build error during instrumentation. This is because your app has reached the limit of the Android build architecture. To resolve this, set this option to ‘True’ and retry instrumenting.

    Other instrumentation flags: Here you can add individual flags to apply to the instrumentation process. These are simply the settings you find here, except in parameter form, e.g. -nores for the option Avoid resources decompiling.

    Redistribute smali: If you receive an error message that indicates issues with the number of methods in the decompiled smali code, set this option to ‘True’. Ranorex Studio will then distribute the code across multiple files.

    Static instrumentation: If you receive an error message of the type “Register count exceeds…” or “Method count exceeds 65k”, set this option to true. Ranorex Studio will then use a special instrumentation mechanism that highly reduces the amount of code that needs to be added to user activities.
    Try the option “Redistribute smali” before activating this option!

    Signing APK

    If you want to sign your APK, you need to specify all of these options.