Genymobile / Genymobile/scrcpy

[server] ERROR: Could not invoke method

Open
#4,334 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
150k
Forks
13.8k
Avg merge
4d 13h
Merged PRs (30d)
2

Description

  • I have read the FAQ.
  • I have searched in existing issues.

Environment

  • OS: Windows
  • scrcpy version: 2.1.1
  • installation method: Windows release
  • device model: Redmi 10s
  • Android version: 13 TP1A.220624.014

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the error with a Redmi 10s on Android 13 using scrcpy 2.1.1, then trace the reported calls through server/src/main/java/com/genymobile/scrcpy/wrappers/InputManager.java and Device.java. Determine why input injection fails and document a verified fix or workaround, including the relevant console output.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.