Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
111.03k stars 10.64k forks source link

[server] ERROR: Could not invoke method #4334

Open EndermanAndrew opened 1 year ago

EndermanAndrew commented 1 year ago

Environment

Describe the bug I get this error as soon as i connect the device

On errors, please provide the output of the console (and adb logcat if relevant).

[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:37)
        at com.genymobile.scrcpy.Device.injectEvent(Device.java:225)
        at com.genymobile.scrcpy.Device.injectKeyEvent(Device.java:236)
        at com.genymobile.scrcpy.Device.pressReleaseKeycode(Device.java:244)
        at com.genymobile.scrcpy.Device.pressReleaseKeycode(Device.java:249)
        at com.genymobile.scrcpy.Controller.control(Controller.java:70)
        at com.genymobile.scrcpy.Controller.lambda$start$0$com-genymobile-scrcpy-Controller(Controller.java:91)
        at com.genymobile.scrcpy.Controller$$ExternalSyntheticLambda1.run(Unknown Source:4)
        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
Caused by: android.os.RemoteException: Remote stack trace:
        at com.android.server.input.InputManagerService.injectInputEventToTarget(InputManagerService.java:908)
        at android.hardware.input.IInputManager$Stub.onTransact(IInputManager.java:617)
        at android.os.Binder.execTransactInternal(Binder.java:1285)
        at android.os.Binder.execTransact(Binder.java:1249)

Please do not post screenshots of your terminal, just post the content as text instead.

rom1v commented 1 year ago

https://github.com/Genymobile/scrcpy#prerequisites https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#mouse-and-keyboard-do-not-work