Ranorex Help Center How can we help you?

Instrumentation with Source Code

Note: Note: It's recommended to fresh instrument your app for every new Ranorex release. For further information have a look at the section ' Mobile Testing - Versioning'.
  1. Link the Ranorex JAR library to your android project. You can find the Ranorex.jar file in your Ranorex installation directory:
    <Ranorex install dir>\bin\RxEnv\Android\Ranorex.jar
  2. Manually add following code to all your Activities:
    @Override  
    public void onResume()  
    {  
     super.onResume();  
     com.ranorex.android.RanorexAndroidAutomation.Hook(this);  
    }  
      
    @Override  
    public void onPause()  
    {  
     super.onPause();  
     com.ranorex.android.RanorexAndroidAutomation.UnHook(this);  
    }  
      
    @Override  
    public boolean dispatchKeyEvent(android.view.KeyEvent event)  
    {  
     com.ranorex.android.RanorexAndroidAutomation.Key(event);  
     return super.dispatchKeyEvent(event);  
    }  
    
    
    
    
  3. Add permissions to your manifest file (if not already in place):
    <uses-permission android:name="android.permission.INTERNET" />  
    <uses-permission android:name="android.permission.INJECT_EVENTS" />  
    
    
    
    
  4. In your AndroidManifest.xml under the application node add:
    <meta-data android:name="RxVersion" android:value="5.0.0" />  
    <meta-data android:name="RxLibVersion" android:value="1.5.0" /> 
    
    
    
    
    with the corresponding Ranorex and automation library version.