INJECT_EVENTS permission intermittently

Mobile Testing, Android App Testing.
Posts: 28
Joined: Wed Sep 03, 2014 12:32 pm

INJECT_EVENTS permission intermittently

Post by thilina » Tue May 24, 2016 8:49 am

when executing android tests, I get this error intermittently.

can't say when it happens, some times this get success, sometimes fails

Injecting to another application requires INJECT_EVENTS permission

Code: Select all

at Ranorex.Plugin.Mobile.XmlRpc.XmlRpcProtocolChannel.Call(MethodCall mc, TimeSpan responseTimeout) at Ranorex.Plugin.Mobile.Device.Channels.AppLogicChannel.Touch(String loc, Int32 elementIdentifier, Boolean isLongClick, Int32 duration) at Ranorex.Plugin.Mobile.Device.Channels.AppLogicChannel.Touch(IElementWithId element, TouchEvent evt) at Ranorex.Plugin.Mobile.RxIntegration.Elements.MobileFlavorElement.Touch(TouchEvent evt) at Ranorex.Touch.Tap(Element element, Int32 pointer, Location location, Duration touchDuration) at Ranorex.Adapter.Touch() at AndroidTests.PNL.Activities.Recording_Modules.Summary.Summary_Next.Ranorex.Core.Testing.ITestModule.Run() in f:\Ranorex\ranorex\AutomationTestSuite\AndroidTests\PNL\Activities\Recording Modules\Summary\Summary_Next.cs:line 86 at Ranorex.Core.Testing.TestSuiteModule.RunInternal(DataContext parentDataContext

User avatar
Ranorex Guru
Ranorex Guru
Posts: 7465
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: INJECT_EVENTS permission intermittently

Post by odklizec » Tue May 24, 2016 9:05 am


Could you please tell us, what version of Ranorex do you use? If not the latest 6.0, try it then (and of course, corresponding Android app ... chive.html).
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Posts: 28
Joined: Wed Sep 03, 2014 12:32 pm

Re: INJECT_EVENTS permission intermittently

Post by thilina » Mon Jun 13, 2016 8:21 am

I get the same error with

Ranorex studio 6 and Ranorex service 1.8.6

Posts: 65
Joined: Wed Sep 24, 2014 7:47 am
Location: Israel

Re: INJECT_EVENTS permission intermittently

Post by zivshapirawork » Tue Jun 14, 2016 8:04 am

while investigating, try to catch the specific exception and do a retry loop (maybe 3 times) on the action.
Since this does not always happen, then the action might succeed.

Posts: 82
Joined: Fri Oct 24, 2014 10:58 am
Location: Bucharest

Re: INJECT_EVENTS permission intermittently

Post by lucian.teodorescu » Tue Jun 14, 2016 8:12 am


I am also facing the same issue for some long time.
Most of the times this happens when some action is not naturally possible e.g.: touch on some (not all) invisible element.
I use genymotion virtual device (VD) to test our android apps. Real devices connected through USB are way too slow because of the ADB. VD is connected via WiFi.
Sometimes, during lengthy tests, VD becomes slow and the actions are delayed so long that INJECT_EVENTS error occurs.

To overcame this issue I restart the VD from time to time. Actually I close it, wait for the process to stop and memory to be cleared and then start it again. All these steps are performed automatically using adb commands.

Hope this helps.
Lucian Teodorescu
NetSun Software

Posts: 4
Joined: Tue Mar 27, 2018 3:24 pm

Re: INJECT_EVENTS permission intermittently

Post by asishr » Thu May 03, 2018 5:06 pm

Anybody still having this issue on Ranorex 8.1?The element I am looking for is also visible & I use a real device so suggested work around didn`t worked for me. I have device connected with USB :oops: