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
armm29393 added a commit to armm29393/scrcpy-root that referenced this issue May 24, 2024
scrcpy v2.4

Changes since v2.3.1:
 - Add UHID keyboard and mouse support (Genymobile#4473)
 - Simulate tilt multitouch by pressing Shift (Genymobile#4529)
 - Add rotation support for non-default display (Genymobile#4698)
 - Improve audio player (Genymobile#4572)
 - Adapt to display API changes in Android 15 (Genymobile#4646, Genymobile#4656, Genymobile#4657)
 - Adapt audio workarounds to Android 14 (Genymobile#4492)
 - Fix clipboard for IQOO devices on Android 14 (Genymobile#4492, Genymobile#4589, Genymobile#4703)
 - Fix integer overflow for audio packet duration (Genymobile#4536)
 - Rework cleanup (Genymobile#4649)
 - Upgrade FFmpeg to 6.1.1 in Windows releases (Genymobile#4713)
 - Upgrade libusb to 1.0.27 in Windows releases (Genymobile#4713)
 - Various technical fixes
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