I’ve been using scrcpy to mirror my Android device on my PC, and everything looks great on the screen. However, I’m running into an issue when I try to control the device with my mouse or keyboard. As soon as I hover over the mirrored screen and try to click or type, nothing happens. Instead, I get this error in the command window:
[server] ERROR: Could not invoke method
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.genymobile.scrcpy.wrappers.InputManager.injectInputEvent(InputManager.java:58)
at com.genymobile.scrcpy.device.Device.injectEvent(Device.java:234)
at com.genymobile.scrcpy.device.Device.injectEvent(Device.java:238)
at com.genymobile.scrcpy.control.Controller.injectTouch(Controller.java:368)
at com.genymobile.scrcpy.control.Controller.handleEvent(Controller.java:167)
at com.genymobile.scrcpy.control.Controller.control(Controller.java:102)
at com.genymobile.scrcpy.control.Controller.lambda$start$0$com-genymobile-scrcpy-control-Controller(Controller.java:110)
at com.genymobile.scrcpy.control.Controller$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.SecurityException: Injecting input events requires the caller (or the source of the instrumentation, if any) to have the INJECT_EVENTS permission.
at android.os.Parcel.createExceptionOrNull(Parcel.java:3011)
at android.os.Parcel.createException(Parcel.java:2995)
at android.os.Parcel.readException(Parcel.java:2978)
at android.os.Parcel.readException(Parcel.java:2920)
at android.hardware.input.IInputManager$Stub$Proxy.injectInputEventToTarget(IInputManager.java:1294)
at android.hardware.input.InputManager.injectInputEvent(InputManager.java:1153)
at android.hardware.input.InputManager.injectInputEvent(InputManager.java:1182)
... 10 more
It seems like the issue is related to some sort of permission (INJECT_EVENTS) that’s needed but not granted. I’ve got USB debugging enabled on my phone, and I’m not sure what else I might need to do to get this working. I’m using scrcpy 2.6.1 with a xiaomi note 11 device that has android 13 in it
I’ve been using scrcpy to mirror my Android device on my PC, and everything looks great on the screen. However, I’m running into an issue when I try to control the device with my mouse or keyboard. As soon as I hover over the mirrored screen and try to click or type, nothing happens. Instead, I get this error in the command window:
[server] ERROR: Could not invoke method java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at com.genymobile.scrcpy.wrappers.InputManager.injectInputEvent(InputManager.java:58) at com.genymobile.scrcpy.device.Device.injectEvent(Device.java:234) at com.genymobile.scrcpy.device.Device.injectEvent(Device.java:238) at com.genymobile.scrcpy.control.Controller.injectTouch(Controller.java:368) at com.genymobile.scrcpy.control.Controller.handleEvent(Controller.java:167) at com.genymobile.scrcpy.control.Controller.control(Controller.java:102) at com.genymobile.scrcpy.control.Controller.lambda$start$0$com-genymobile-scrcpy-control-Controller(Controller.java:110) at com.genymobile.scrcpy.control.Controller$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0) at java.lang.Thread.run(Thread.java:1012) Caused by: java.lang.SecurityException: Injecting input events requires the caller (or the source of the instrumentation, if any) to have the INJECT_EVENTS permission. at android.os.Parcel.createExceptionOrNull(Parcel.java:3011) at android.os.Parcel.createException(Parcel.java:2995) at android.os.Parcel.readException(Parcel.java:2978) at android.os.Parcel.readException(Parcel.java:2920) at android.hardware.input.IInputManager$Stub$Proxy.injectInputEventToTarget(IInputManager.java:1294) at android.hardware.input.InputManager.injectInputEvent(InputManager.java:1153) at android.hardware.input.InputManager.injectInputEvent(InputManager.java:1182) ... 10 more
It seems like the issue is related to some sort of permission (INJECT_EVENTS) that’s needed but not granted. I’ve got USB debugging enabled on my phone, and I’m not sure what else I might need to do to get this working. I’m using scrcpy 2.6.1 with a xiaomi note 11 device that has android 13 in it