scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

Attempt to invoke virtual method 'int android.content.Context.getDeviceId()' on a null object reference

Open plantfall opened this issue 1 year ago • 4 comments

image

scrcpy 2.0 https://github.com/Genymobile/scrcpy C:\DEV\ANDROID\SCRCPY\scrcpy-win64-v2.0\scrcpy-server: 1 file pushed, 0 skipped. 5.4 MB/s (52867 bytes in 0.009s) [server] INFO: Device: Xiaomi 2303ERA42L (Android 14) [server] ERROR: Could not invoke method java.lang.NoSuchMethodException: android.content.IClipboard$Stub$Proxy.addPrimaryClipChangedListener [interface android.content.IOnPrimaryClipChangedListener, class java.lang.String, class java.lang.String, int] at java.lang.Class.getMethod(Class.java:2937) at java.lang.Class.getMethod(Class.java:2449) at com.genymobile.scrcpy.wrappers.ClipboardManager.getAddPrimaryClipChangedListener(ClipboardManager.java:129) at com.genymobile.scrcpy.wrappers.ClipboardManager.addPrimaryClipChangedListener(ClipboardManager.java:139) at com.genymobile.scrcpy.Device.(Device.java:100) at com.genymobile.scrcpy.Server.scrcpy(Server.java:64) at com.genymobile.scrcpy.Server.main(Server.java:381) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:372) [server] ERROR: Exception on thread Thread[Thread-4,5,main] java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.Context.getDeviceId()' on a null object reference at android.content.ContextWrapper.getDeviceId(ContextWrapper.java:1246) at android.media.AudioRecord.resolveSessionId(AudioRecord.java:1136) at android.media.AudioRecord.(AudioRecord.java:472) at android.media.AudioRecord.(Unknown Source:0) at android.media.AudioRecord$Builder.build(AudioRecord.java:1097) at com.genymobile.scrcpy.AudioCapture.createAudioRecord(AudioCapture.java:58) at com.genymobile.scrcpy.AudioCapture.start(AudioCapture.java:90) at com.genymobile.scrcpy.AudioEncoder.encode(AudioEncoder.java:183) at com.genymobile.scrcpy.AudioEncoder.lambda$start$0$com-genymobile-scrcpy-AudioEncoder(AudioEncoder.java:120) at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda0.run(Unknown Source:2) at java.lang.Thread.run(Thread.java:1012) INFO: Renderer: direct3d WARN: Demuxer 'audio': stream explicitly disabled by the device INFO: Initial texture: 1080x2400

plantfall avatar Apr 12 '24 11:04 plantfall

scrcpy 2.0

Upgrade to the latest version (currently 2.4).

rom1v avatar Apr 12 '24 12:04 rom1v

The problem still exists

C:\Users\lenovo\Downloads\scrcpy-win64-v2.4\scrcpy-server:... file pushed, 0 skipped. 77.4 MB/s (69007 bytes in 0.001s) [server] INFO: Device: [Xiaomi] Xiaomi 23116PN5BC (Android 14) INFO: Renderer: direct3d INFO: Texture: 1440x3200 [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.injectEvent(Device.java:230) at com.genymobile.scrcpy.Device.injectEvent(Device.java:234) at com.genymobile.scrcpy.Controller.injectTouch(Controller.java:362) at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:162) at com.genymobile.scrcpy.Controller.control(Controller.java:97) at com.genymobile.scrcpy.Controller.lambda$start$0$com-genymobile-scrcpy-Controller(Controller.java:105) 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:3057) at android.os.Parcel.createException(Parcel.java:3041) at android.os.Parcel.readException(Parcel.java:3024) at android.os.Parcel.readException(Parcel.java:2966) at android.hardware.input.IInputManager$Stub$Proxy.injectInputEventToTarget(IInputManager.java:1575) at android.hardware.input.InputManagerGlobal.injectInputEvent(InputManagerGlobal.java:1217) at android.hardware.input.InputManagerGlobal.injectInputEvent(InputManagerGlobal.java:1227) ... 10 more Caused by: android.os.RemoteException: Remote stack trace: at com.android.server.input.InputManagerService.injectInputEventToTarget(InputManagerService.java:911) at android.hardware.input.IInputManager$Stub.onTransact(IInputManager.java:744) at android.os.Binder.execTransactInternal(Binder.java:1346) at android.os.Binder.execTransact(Binder.java:1282) [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.injectEvent(Device.java:230) at com.genymobile.scrcpy.Device.injectEvent(Device.java:234) at com.genymobile.scrcpy.Controller.injectTouch(Controller.java:362) at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:162) at com.genymobile.scrcpy.Controller.control(Controller.java:97) at com.genymobile.scrcpy.Controller.lambda$start$0$com-genymobile-scrcpy-Controller(Controller.java:105) 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:3057) at android.os.Parcel.createException(Parcel.java:3041) at android.os.Parcel.readException(Parcel.java:3024) at android.os.Parcel.readException(Parcel.java:2966) at android.hardware.input.IInputManager$Stub$Proxy.injectInputEventToTarget(IInputManager.java:1575) at android.hardware.input.InputManagerGlobal.injectInputEvent(InputManagerGlobal.java:1217) at android.hardware.input.InputManagerGlobal.injectInputEvent(InputManagerGlobal.java:1227) ... 10 more [server] ERROR: Could not invoke method

CuteOri avatar May 16 '24 09:05 CuteOri

java.lang.SecurityException: Injecting input events requires the caller (or the source of the instrumentation, if any) to have the INJECT_EVENTS permission

That's not the same problem.

Please read https://github.com/Genymobile/scrcpy#prerequisites

rom1v avatar May 16 '24 09:05 rom1v

java.lang.SecurityException: Injecting input events requires the caller (or the source of the instrumentation, if any) to have the INJECT_EVENTS permission

That's not the same problem.

Please read https://github.com/Genymobile/scrcpy#prerequisites

I just read other issues and restarted the phone to solve the problem, thank you.

CuteOri avatar May 16 '24 09:05 CuteOri