Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
106.43k stars 10.31k forks source link

Unable to connect.[server] ERROR: Exception on thread Thread[main,5,main] #4349

Open moxi000 opened 9 months ago

moxi000 commented 9 months ago

moxi@MacBook-Pro ~ % scrcpy scrcpy 2.1.1 https://github.com/Genymobile/scrcpy INFO: ADB device found: INFO: --> (usb) EC2199C9 device Tab10C /opt/homebrew/Cellar/scrcpy/2.1.1/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 52.1 MB/s (56995 bytes in 0.001s) [server] INFO: Device: [ONYX] ONYX Tab10C (Android 11) [server] ERROR: Exception on thread Thread[main,5,main] java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.ContentResolver android.content.Context.getContentResolver()' on a null object reference at android.content.ContextWrapper.getContentResolver(ContextWrapper.java:107) at android.content.ContextWrapper.getContentResolver(ContextWrapper.java:107) at android.hardware.input.InputManager.setupPointerNaturalRolling(InputManager.java:295) at android.hardware.input.InputManager.registerPointerSettingObserver(InputManager.java:261) at android.hardware.input.InputManager.(InputManager.java:255) at android.hardware.input.InputManager.getInstance(InputManager.java:326) at android.view.KeyCharacterMap.load(KeyCharacterMap.java:334) at com.genymobile.scrcpy.Controller.(Controller.java:35) at com.genymobile.scrcpy.Server.scrcpy(Server.java:113) at com.genymobile.scrcpy.Server.main(Server.java:199) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399) INFO: Renderer: metal ERROR: Demuxer 'video': stream disabled due to connection error ERROR: Demuxer 'audio': stream disabled due to connection error ERROR: Demuxer error moxi@MacBook-Pro ~ %

rom1v commented 9 months ago

Something has been changed in your rom by the vendor.

Please post your framework.jar. Download it from your device with the following command:

adb pull /system/framework/framework.jar
l-leroux commented 8 months ago

I had the same message on mint 20.2 with a Fairphone 3 : INFO: scrcpy 1.12.1 <https://github.com/Genymobile/scrcpy> /usr/share/scrcpy/scrcpy-server: 1 file pushed. 3.2 MB/s (24773 bytes in 0.007s) INFO: Initial texture: 1080x2160 [server] ERROR: Exception on thread Thread[main,5,main] WARN: Device disconnected The framework.jar is here : https://nuage03.apps.education.fr/index.php/s/YKqqoDby24g36o7

Thanks !

rom1v commented 8 months ago

scrcpy 1.12.1

Too old. Install the latest version manually.

l-leroux commented 8 months ago

Thanks ! That's it !

DanSyor commented 8 months ago

Got very similar issue after an update. framework.jar

scrcpy v2.2 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)              2E8861A9            device  NoteAir2P
C:\Utils\scrcpy\scrcpy-server: 1 file pushed, 0 skipped. 130.2 MB/s (64363 bytes in 0.000s)
[server] INFO: Device: [ONYX] ONYX NoteAir2P (Android 11)
[server] ERROR: Attempt to invoke virtual method 'android.content.ContentResolver android.content.Context.getContentResolver()' on a null object reference
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.ContentResolver android.content.Context.getContentResolver()' on a null object reference
        at android.content.ContextWrapper.getContentResolver(ContextWrapper.java:107)
        at android.content.ContextWrapper.getContentResolver(ContextWrapper.java:107)
        at android.hardware.input.InputManager.setupPointerNaturalRolling(InputManager.java:321)
        at android.hardware.input.InputManager.registerPointerSettingObserver(InputManager.java:291)
        at android.hardware.input.InputManager.<init>(InputManager.java:283)
        at android.hardware.input.InputManager.getInstance(InputManager.java:357)
        at android.view.KeyCharacterMap.load(KeyCharacterMap.java:334)
        at com.genymobile.scrcpy.Controller.<init>(Controller.java:35)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:118)
        at com.genymobile.scrcpy.Server.internalMain(Server.java:235)
        at com.genymobile.scrcpy.Server.main(Server.java:190)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
INFO: Renderer: direct3d
ERROR: Demuxer 'video': stream disabled due to connection error
ERROR: Demuxer 'audio': stream disabled due to connection error
ERROR: Demuxer error

EDIT: works with --no-audio but pretty sure it used to work without that option.

rom1v commented 8 months ago

Could you please test with the scrcpy-server posted in #4392?

DanSyor commented 8 months ago

OK, tested with file from this post, got this:

scrcpy v2.2 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)              2E8861A9            device  NoteAir2P
C:\Utils\scrcpy\scrcpy-server: 1 file pushed, 0 skipped. 11.8 MB/s (154598 bytes in 0.012s)
[server] INFO: Device: [ONYX] ONYX NoteAir2P (Android 11)
[server] ERROR: Given calling package android does not match caller's uid 2000
java.lang.SecurityException: Given calling package android does not match caller's uid 2000
        at android.os.Parcel.createExceptionOrNull(Parcel.java:2374)
        at android.os.Parcel.createException(Parcel.java:2358)
        at android.os.Parcel.readException(Parcel.java:2341)
        at android.os.Parcel.readException(Parcel.java:2283)
        at android.app.IActivityManager$Stub$Proxy.getContentProvider(IActivityManager.java:5808)
        at android.app.ActivityThread.acquireProvider(ActivityThread.java:6936)
        at android.app.ContextImpl$ApplicationContentResolver.acquireProvider(ContextImpl.java:2912)
        at android.content.ContentResolver.acquireProvider(ContentResolver.java:2470)
        at android.provider.Settings$ContentProviderHolder.getProvider(Settings.java:2596)
        at android.provider.Settings$NameValueCache.getStringForUser(Settings.java:2725)
        at android.provider.Settings$Global.getStringForUser(Settings.java:13469)
        at android.provider.Settings$Global.getString(Settings.java:13457)
        at android.provider.Settings$Global.getInt(Settings.java:13662)
        at android.hardware.input.InputManager.setupPointerNaturalRolling(InputManager.java:321)
        at android.hardware.input.InputManager.registerPointerSettingObserver(InputManager.java:291)
        at android.hardware.input.InputManager.<init>(InputManager.java:283)
        at android.hardware.input.InputManager.getInstance(InputManager.java:357)
        at android.view.KeyCharacterMap.load(KeyCharacterMap.java:334)
        at com.genymobile.scrcpy.Controller.<init>(Controller.java:35)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:118)
        at com.genymobile.scrcpy.Server.internalMain(Server.java:235)
        at com.genymobile.scrcpy.Server.main(Server.java:190)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
Caused by: android.os.RemoteException: Remote stack trace:
        at com.android.server.am.ActivityManagerService.getContentProvider(ActivityManagerService.java:7715)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2425)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2926)
        at android.os.Binder.execTransactInternal(Binder.java:1154)
        at android.os.Binder.execTransact(Binder.java:1123)

INFO: Renderer: direct3d
ERROR: Demuxer 'video': stream disabled due to connection error
ERROR: Demuxer 'audio': stream disabled due to connection error
ERROR: Demuxer error

Still works with --no-audio.

rom1v commented 8 months ago

OK, some parts require ActivityThread.currentApplication() to return a non-null Application (for audio and camera for example), but if it is not null, some other parts (InputManager in your ROM) perform more actions, some of them which could not work. :/

BeInspired85 commented 5 months ago

Got similar error: [server] ERROR: Exception on thread Thread[Thread-2,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:1252) at android.media.AudioRecord.resolveSessionId(AudioRecord.java:1175) at android.media.AudioRecord.(AudioRecord.java:476) at android.media.AudioRecord.(Unknown Source:0) at android.media.AudioRecord$Builder.build(AudioRecord.java:1062) 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

rom1v commented 5 months ago

Which device? Which Android version? Which scrcpy version?

BeInspired85 commented 5 months ago

  Hello Romain,   I used old version. After I updated to the new version — everything works well. So — my comment is not actual. Initially it didn’t work on Samsung S21FE, Android 13.   Best regards, Alexey     

Thursday, February 22, 2024 4:33 PM +01:00 from Romain Vimont @.***>:     Which device? Which Android version? Which scrcpy version? — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you commented. Message ID: <Genymobile/scrcpy/issues/4349/1959698558 @ github . com>  

AJolly commented 2 months ago

I'm having the opposite issue: older versions of scrcpy work fine, newer do not. scrcpy 1.25 https://github.com/Genymobile/scrcpy C:\ccdc\PortableApps\scrcpy\scrcpy-server: 1 file pushed, 0 skipped. 164.6 MB/s (42151 bytes in 0.000s) [server] INFO: Device: ONYX Page (Android 11) INFO: Renderer: direct3d INFO: Initial texture: 1264x1680 [server] ERROR: Encoding error: android.media.MediaCodec$CodecException: Error 0xfffffff4 [server] INFO: Retrying with -m1600... INFO: New texture: 1200x1600 INFO: FPS counter started INFO: 9 fps (+1 frames skipped) INFO: 1 fps INFO: 0 fps INFO: 0 fps INFO: 0 fps INFO: 0 fps INFO: 2 fps INFO: 10 fps INFO: 0 fps INFO: 0 fps INFO: 0 fps INFO: 0 fps INFO: 0 fps INFO: 0 fps INFO: 0 fps INFO: 3 fps INFO: 9 fps Terminate batch job (Y/N)? ^C

vs

c:\ccdc\PortableApps\scrcpy>scrcpy --stay-awake --shortcut-mod=lctrl --serial 192.168.40.191:5555 --print-fps scrcpy 2.4 https://github.com/Genymobile/scrcpy INFO: ADB device found: INFO: (tcpip) 192.168.40.121:5555 device LE2125 INFO: --> (tcpip) 192.168.40.191:5555 device Page c:\ccdc\PortableApps\scrcpy\scrcpy-server: 1 file pushed, 0 skipped. 75.9 MB/s (69007 bytes in 0.001s) [server] INFO: Device: [ONYX] ONYX Page (Android 11) [server] ERROR: Given calling package android does not match caller's uid 2000 java.lang.SecurityException: Given calling package android does not match caller's uid 2000 at android.os.Parcel.createExceptionOrNull(Parcel.java:2374) at android.os.Parcel.createException(Parcel.java:2358) at android.os.Parcel.readException(Parcel.java:2341) at android.os.Parcel.readException(Parcel.java:2283) at android.app.IActivityManager$Stub$Proxy.getContentProvider(IActivityManager.java:5808) at android.app.ActivityThread.acquireProvider(ActivityThread.java:6937) at android.app.ContextImpl$ApplicationContentResolver.acquireProvider(ContextImpl.java:2912) at android.content.ContentResolver.acquireProvider(ContentResolver.java:2470) at android.provider.Settings$ContentProviderHolder.getProvider(Settings.java:2596) at android.provider.Settings$NameValueCache.getStringForUser(Settings.java:2725) at android.provider.Settings$Global.getStringForUser(Settings.java:13469) at android.provider.Settings$Global.getString(Settings.java:13457) at android.provider.Settings$Global.getInt(Settings.java:13662) at android.hardware.input.InputManager.setupPointerNaturalRolling(InputManager.java:321) at android.hardware.input.InputManager.registerPointerSettingObserver(InputManager.java:291) at android.hardware.input.InputManager.(InputManager.java:283) at android.hardware.input.InputManager.getInstance(InputManager.java:357) at android.view.KeyCharacterMap.load(KeyCharacterMap.java:334) at com.genymobile.scrcpy.Controller.(Controller.java:40) at com.genymobile.scrcpy.Server.scrcpy(Server.java:135) at com.genymobile.scrcpy.Server.internalMain(Server.java:259) at com.genymobile.scrcpy.Server.main(Server.java:214) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399) Caused by: android.os.RemoteException: Remote stack trace: at com.android.server.am.ActivityManagerService.getContentProvider(ActivityManagerService.java:7715) at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2425) at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2926) at android.os.Binder.execTransactInternal(Binder.java:1154) at android.os.Binder.execTransact(Binder.java:1123)

INFO: Renderer: direct3d ERROR: Demuxer 'video': stream disabled due to connection error ERROR: Demuxer 'audio': stream disabled due to connection error ERROR: Demuxer error

AJolly commented 2 months ago

Also its interesting: Almost everyone here is commenting about an Onyx ebook reader device.