0

I am using UIAUTOMATOR for doing uiautomation for android 5.0.1 version.While i am clicking on device screenshot option in UIAUTOMATOR getting this error Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Permission denied.Can anyone guide me what might be the reason for this?

Suneetha Thentu
  • 83
  • 2
  • 11
  • Without code no one can help you. – Haresh Chhelana May 29 '15 at 09:01
  • i am not using any code.I connected my device to the system.when i am running 'adb devices' it is showing my device .After that i ran uiautomator.bat under SDK/tools folder .Then Uiautomatorviewer panel is opened and when i clicked on device screenshot (second option) in UIautomator panel it is giving the above error. – Suneetha Thentu May 29 '15 at 09:23
  • Please check if you have authenticated the device while connecting to the PC. Check this answer [permission issue](http://stackoverflow.com/questions/23081263/adb-android-device-unauthorized) – Dnavir Jun 01 '15 at 10:22
  • Yes i have authenticated the device and my device is rooted also. @SyedMehtab.Can you suggest me any other solution. – Suneetha Thentu Jun 03 '15 at 15:54
  • Just try `adb root` and start `uiautomatorviewer` – Rilwan Jun 08 '15 at 04:04
  • Thanks @Rilwan .its working. – Suneetha Thentu Jun 08 '15 at 05:46

2 Answers2

4

I did the below steps because my device is rooted.

adb root
uiautomatorviewer

Thanks to @Rliwan for providing me the solution in comments.Just i want to close the question,so i am posting this answer.

Suneetha Thentu
  • 83
  • 2
  • 11
0

If you add the getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);' into Actvitiy onCreate(),You may encounter this problem.

androidmalin
  • 899
  • 1
  • 8
  • 12