Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrcpy crash if target device doesn't have clipboard service #1556

Closed
auzeonfung opened this issue Jul 2, 2020 · 4 comments
Closed

Scrcpy crash if target device doesn't have clipboard service #1556

auzeonfung opened this issue Jul 2, 2020 · 4 comments

Comments

@auzeonfung
Copy link
Contributor

Hi there!

I'm using scrcpy to control my Android based speaker which is without a screen.
It runs a deeply customized Android system and version is 5.1.1.

It was able to successfully connect and control it with the mouse and keyboard before scrcpy upgrade to version 1.14.

2020-07-02 20:28:36.255 scrcpy[20348:1741473] INFO: scrcpy 1.14 <https://github.com/Genymobile/scrcpy>
/usr/local/Cellar/scrcpy/1.14_1/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 24.8 MB/s (33142 bytes in 0.001s)
adb: error: more than one device and emulator
2020-07-02 20:28:36.412 scrcpy[20348:1741473] ERROR: "adb reverse" returned with value 1
2020-07-02 20:28:36.412 scrcpy[20348:1741473] WARN: 'adb reverse' failed, fallback to 'adb forward'
27183
[server] INFO: Device: phicomm rk322x-box (Android 5.1.1)
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
	at com.genymobile.scrcpy.wrappers.ClipboardManager.getAddPrimaryClipChangedListener(ClipboardManager.java:99)
	at com.genymobile.scrcpy.wrappers.ClipboardManager.addPrimaryClipChangedListener(ClipboardManager.java:111)
	at com.genymobile.scrcpy.Device.<init>(Device.java:83)
	at com.genymobile.scrcpy.Server.scrcpy(Server.java:23)
	at com.genymobile.scrcpy.Server.main(Server.java:225)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:249)
##@###noMacBook-Pro ~ % adb shell service call clipboard 1
service: Service clipboard does not exist

It's possible to connect the same device successfully using an older version of scrcpy.

##@####noMacBook-Pro ~ % scrcpy
2020-07-02 22:10:53.142 scrcpy[36828:1830562] INFO: scrcpy 1.13 <https://github.com/Genymobile/scrcpy>
/usr/local/Cellar/scrcpy/1.13/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 64.2 MB/s (27694 bytes in 0.000s)
adb: error: more than one device and emulator
2020-07-02 22:10:53.280 scrcpy[36828:1830562] ERROR: "adb reverse" returned with value 1
2020-07-02 22:10:53.280 scrcpy[36828:1830562] WARN: 'adb reverse' failed, fallback to 'adb forward'
27183
[server] INFO: Device: phicomm rk322x-box (Android 5.1.1)
2020-07-02 22:10:54.166 scrcpy[36828:1830562] INFO: Renderer: metal
2020-07-02 22:10:54.166 scrcpy[36828:1830562] WARN: Trilinear filtering disabled (not an OpenGL renderer)
2020-07-02 22:10:54.169 scrcpy[36828:1830562] INFO: Initial texture: 1440x960

image

Would it be a good idea to add an option to allow users to ignore this error? 😁

@rom1v
Copy link
Collaborator

rom1v commented Jul 2, 2020

Ref: #1440

@auzeonfung
Copy link
Contributor Author

Yes, I'm experiencing a similar situation to #1440 .
I can't use the copy function, but I can still at least control my device using the mouse and keyboard by using older version but the latest version can't...
I know it's annoying, but would you consider adding an option to dodge this issue? (--ignore-errors or something like that)? Thank you!

rom1v added a commit that referenced this issue Jul 3, 2020
Some devices have no clipboard manager.

In that case, do not try to enable clipboard synchronization to avoid
a crash.

Fixes #1440 <#1440>
Fixes #1556 <#1556>
@rom1v
Copy link
Collaborator

rom1v commented Jul 3, 2020

Could you try the clipboard_manager branch, please?

@auzeonfung
Copy link
Contributor Author

Thank you very much! clipboard_manager branch works very well.
Also when I tried to bulid the server from source code myself I found the documentation to be a bit out of date, I'll submit a pr later to improve it.
Thanks for all you do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants