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

getPrimaryClip and setPrimaryClip not work #4703

Closed
2 tasks done
vimuxx opened this issue Feb 26, 2024 · 3 comments
Closed
2 tasks done

getPrimaryClip and setPrimaryClip not work #4703

vimuxx opened this issue Feb 26, 2024 · 3 comments

Comments

@vimuxx
Copy link

vimuxx commented Feb 26, 2024

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

Environment

  • OS: Debian 12
  • scrcpy version: v2.3.1
  • installation method: manual build, with install_release.sh
  • device model: IQOO Neo 8
  • Android version: 14 [PD2301_A_14.19.11.W10.V000L1]

Describe the bug

  1. getPrimaryClip and setPrimaryClip not work on git commit 5a6b831:
[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: android.content.IClipboard$Stub$Proxy.getPrimaryClip [class java.lang.String, int, class java.lang.String]
	at java.lang.Class.getMethod(Class.java:2937)
	at java.lang.Class.getMethod(Class.java:2449)
	at com.genymobile.scrcpy.wrappers.ClipboardManager.getGetPrimaryClipMethod(ClipboardManager.java:44)
	at com.genymobile.scrcpy.wrappers.ClipboardManager.getText(ClipboardManager.java:117)
	at com.genymobile.scrcpy.Device.getClipboardText(Device.java:286)
	at com.genymobile.scrcpy.Device.setClipboardText(Device.java:299)
	at com.genymobile.scrcpy.Controller.setClipboard(Controller.java:396)
	at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:164)
	at com.genymobile.scrcpy.Controller.control(Controller.java:83)
	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:1042)
[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: android.content.IClipboard$Stub$Proxy.setPrimaryClip [class android.content.ClipData, class java.lang.String, class java.lang.String, int, int]
	at java.lang.Class.getMethod(Class.java:2937)
	at java.lang.Class.getMethod(Class.java:2449)
	at com.genymobile.scrcpy.wrappers.ClipboardManager.getSetPrimaryClipMethod(ClipboardManager.java:68)
	at com.genymobile.scrcpy.wrappers.ClipboardManager.setText(ClipboardManager.java:131)
	at com.genymobile.scrcpy.Device.setClipboardText(Device.java:309)
	at com.genymobile.scrcpy.Controller.setClipboard(Controller.java:396)
	at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:164)
	at com.genymobile.scrcpy.Controller.control(Controller.java:83)
	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:1042)

  1. Tried scrcpy-server from scrcpy-win64-fix4589.zip and the getPrimaryClip fixed but not setPrimaryClip:
INFO: Device clipboard copied
[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: android.content.IClipboard$Stub$Proxy.setPrimaryClip [class android.content.ClipData, class java.lang.String, class java.lang.String, int, int]
	at java.lang.Class.getMethod(Class.java:2937)
	at java.lang.Class.getMethod(Class.java:2449)
	at com.genymobile.scrcpy.wrappers.ClipboardManager.getSetPrimaryClipMethod(ClipboardManager.java:81)
	at com.genymobile.scrcpy.wrappers.ClipboardManager.setText(ClipboardManager.java:149)
	at com.genymobile.scrcpy.Device.setClipboardText(Device.java:309)
	at com.genymobile.scrcpy.Controller.setClipboard(Controller.java:396)
	at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:164)
	at com.genymobile.scrcpy.Controller.control(Controller.java:83)
	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:1042)

Seems that we forgot setPrimaryClip?

rom1v added a commit that referenced this issue Feb 26, 2024
The first part of the workaround fixed getPrimaryClip(). This part fixes
setPrimaryClip().

Fixes #4703 <#4703>
Refs 5ce8672
Refs #4492 <#4492>
@rom1v
Copy link
Collaborator

rom1v commented Feb 26, 2024

Thank you for your report.

Please test 746eaea. Here is a binary:

@vimuxx
Copy link
Author

vimuxx commented Feb 26, 2024

it works!

@rom1v
Copy link
Collaborator

rom1v commented Feb 26, 2024

Merged into dev 🎉

@rom1v rom1v closed this as completed Feb 26, 2024
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