Skip to content

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

Closed

Description

@yukiinagato

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? 😁

Activity

  1. rom1v commented on Jul 2, 2020

    @rom1v
    Collaborator

    Ref: #1440

  2. yukiinagato commented on Jul 2, 2020

    @yukiinagato
    ContributorAuthor

    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!

  3. added a commit that references this issue on Jul 3, 2020
    f7d4b6d
  4. rom1v commented on Jul 3, 2020

    @rom1v
    Collaborator

    Could you try the clipboard_manager branch, please?

  5. yukiinagato commented on Jul 3, 2020

    @yukiinagato
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions