2

I want to start an uiautomatorTest program in android code. I use:

Runtime.getRuntime().exec("uiautomator runtest AutoRunner.jar -c com.Runner.AutoRunner");

I get the error:

java.lang.SecurityException: You do not have android.permission.RETRIEVE_WINDOW_CONTENT required to call registerUiTestAutomationService from pid=7071, uid=10156

Can anyone tell me how to solve the problem? thanks

Shree Krishna
  • 8,474
  • 6
  • 40
  • 68

1 Answers1

0

As the discussion It seems, this Permission is only granted to system apps And it seems you may have forgot to add the permission also,

To add the permission :

add this directly to your manifest

   <uses-permission android.permission.RETRIEVE_WINDOW_CONTENT />

OR Inside the service you want the operation to be done like

    <service android:name=".MyAccessibilityService"
         android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
     <intent-filter>
         <action android:name="android.accessibilityservice.AccessibilityService" />
     </intent-filter>
     . . .
 </service>

Have a brief look at Doc

Community
  • 1
  • 1
Shree Krishna
  • 8,474
  • 6
  • 40
  • 68