Robotium 自动化测试报错:Injecting to another application requires INJECT_EVENT permission

本文分享了一次解决Poc程序白天无法运行的问题经历。通过查找资料发现原因是模拟器处于锁屏状态导致被测程序未启动。解决方案是将模拟器设置为不允许锁屏。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天再试昨晚调通的poc攻击程序时突然报错,调了好久程序都不见改变,

甚至怀疑我的程序只过美国时间吗,只有晚上才跑的出来??。。。当然是瞎想

baidu了一下,code/google中的robotium专版真是个好地方,昨晚解决了我jar包的错误,现在也找到了这个问题所在,

网址是http://code.google.com/p/robotium/issues/detail?id=1

里面介绍了这个问题是由于被测程序没有启动,当然主要情况是模拟器处于锁屏状态,

以后就把模拟器设置为不允许锁屏,就ok啦 

哇哈哈 这就解决了我的问题 好开森啊~~~共享之!

[19:49:14][ERROR]<airtest.core.api> Traceback (most recent call last): File "airtest\core\android\adb.py", line 374, in shell File "airtest\core\android\adb.py", line 332, in raw_shell File "airtest\core\android\adb.py", line 197, in cmd airtest.core.error.AdbError: stdout[b''] stderr[b'java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission\r\n\tat android.os.Parcel.createException(Parcel.java:2074)\r\n\tat android.os.Parcel.readException(Parcel.java:2042)\r\n\tat android.os.Parcel.readException(Parcel.java:1990)\r\n\tat android.hardware.input.IInputManager$Stub$Proxy.injectInputEvent(IInputManager.java:991)\r\n\tat android.hardware.input.InputManager.injectInputEvent(InputManager.java:886)\r\n\tat com.android.commands.input.Input.injectMotionEvent(Input.java:428)\r\n\tat com.android.commands.input.Input.access$200(Input.java:41)\r\n\tat com.android.commands.input.Input$InputTap.sendTap(Input.java:224)\r\n\tat com.android.commands.input.Input$InputTap.run(Input.java:218)\r\n\tat com.android.commands.input.Input.onRun(Input.java:108)\r\n\tat com.android.internal.os.BaseCommand.run(BaseCommand.java:56)\r\n\tat com.android.commands.input.Input.main(Input.java:71)\r\n\tat com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)\r\n\tat com.android.internal.os.RuntimeInit.main(RuntimeInit.java:380)\r\nCaused by: android.os.RemoteException: Remote stack trace:\r\n\tat com.android.server.input.InputManagerService.injectInputEventInternal(InputManagerService.java:754)\r\n\tat com.android.server.input.InputManagerService.injectInputEvent(InputManagerService.java:728)\r\n\tat android.hardware.input.IInputManager$Stub.onTransact(IInputManager.java:451)\r\n\tat android.os.Binder.execTransactInternal(Binder.java:1021)\r\n\tat android.os.Binder.execTransact(Binder.java:994)\r\n\r\n'] During handling of the above exception, another exception occurred:
07-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值