Tag Archives: Android performance test

Monkey error: error: A RuntimeException occurred [How to Solve]

When running monkey with Xiaomi mobile phone, the following error occurs just after startup:

** Error: A RuntimeException occurred:
java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
	at android.os.Parcel.createException(Parcel.java:2074)
	at android.os.Parcel.readException(Parcel.java:2042)
	at android.os.Parcel.readException(Parcel.java:1990)
	at android.hardware.input.IInputManager$Stub$Proxy.injectInputEvent(IInputManager.java:925)
	at android.hardware.input.InputManager.injectInputEvent(InputManager.java:886)
	at com.android.commands.monkey.MonkeyKeyEvent.injectEvent(MonkeyKeyEvent.java:133)
	at com.android.commands.monkey.Monkey.runMonkeyCycles(Monkey.java:1324)
	at com.android.commands.monkey.Monkey.run(Monkey.java:815)
	at com.android.commands.monkey.Monkey.main(Monkey.java:675)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:380)
Caused by: android.os.RemoteException: Remote stack trace:
	at com.android.server.input.InputManagerService.injectInputEventInternal(InputManagerService.java:740)
	at com.android.server.input.InputManagerService.injectInputEvent(InputManagerService.java:714)
	at android.hardware.input.IInputManager$Stub.onTransact(IInputManager.java:422)
	at android.os.Binder.execTransactInternal(Binder.java:1021)
	at android.os.Binder.execTransact(Binder.java:994)


** System appears to have crashed at event 1 of 1000000 using seed 200

**Solution**

Turn on USB debugging (security setting) and check the setting ☑️ “It is allowed to modify permissions or simulate clicking through USB debugging”, and it is OK to take off again.