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

Server fails when built with SDK < 33 on macOS #3481

Closed
2 tasks done
metayan opened this issue Sep 2, 2022 · 7 comments
Closed
2 tasks done

Server fails when built with SDK < 33 on macOS #3481

metayan opened this issue Sep 2, 2022 · 7 comments

Comments

@metayan
Copy link

metayan commented Sep 2, 2022

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

Environment

  • macOS 10.15.7 (Catalina)
  • 1.24
  • manual build
  • Sony Xperia G8441
  • Android 9

Problem
When building from source, I keep getting

[server] INFO: Device: Sony G8441 (Android 9)
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.AssertionError: java.lang.NullPointerException: 
 Attempt to invoke virtual method
 'java.lang.reflect.Method java.lang.Class.getMethod(java.lang.String, java.lang.Class[])'
 on a null object reference
        at com.genymobile.scrcpy.wrappers.WindowManager.registerRotationWatcher(WindowManager.java:108)
        at com.genymobile.scrcpy.Device.<init>(Device.java:85)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:65)
        at com.genymobile.scrcpy.Server.main(Server.java:335)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:340)
Caused by: java.lang.NullPointerException:
 Attempt to invoke virtual method
 'java.lang.reflect.Method java.lang.Class.getMethod(java.lang.String, java.lang.Class[])'
 on a null object reference
        at com.genymobile.scrcpy.wrappers.WindowManager.registerRotationWatcher(WindowManager.java:102)
        ... 5 more
2022-09-02 13:12:05.549 scrcpy[48321:5695314] DEBUG: Interrupting socket
2022-09-02 13:12:05.549 scrcpy[48321:5695314] DEBUG: Server disconnected
2022-09-02 13:12:05.549 scrcpy[48321:5695314] DEBUG: Server terminated

Fix
Changing PLATFORM and BUILD_TOOLS in server/build_without_gradle.sh to version 33.

Notes
This has been an issue for "quite a while". (I've had to use the prebuilt server.)
Thought I could bisect to find where this issue appeared, but found that it was already present in v1.23, and couldn't build v1.22, because an older ffmpeg was expected.

@rom1v
Copy link
Collaborator

rom1v commented Sep 2, 2022

Thank you for the report.

I upgraded on dev branch after I saw your message: https://github.com/Genymobile/scrcpy/commits/0a0a446ea6d790420c3d52eb1e6d4afebd086b35

This has been an issue for "quite a while".

I faced the same issue recently, but reverting to an old Java (openjdk) version solved the problem. Upgrading the expected gradle version is better 😉

@rom1v rom1v closed this as completed Sep 2, 2022
@rom1v
Copy link
Collaborator

rom1v commented Sep 2, 2022

@yangfl FYI, scrcpy-server must not be built with an old version of build-tools (< 33) AND a "new" version of javac (e.g. openjdk-18, maybe even openjdk-17). You might be interested in this information for Debian packaging.

@madduck
Copy link
Contributor

madduck commented Mar 13, 2024

@yangfl surely, Debian packaging could encode the need for a newer build-tools, no?

@yangfl
Copy link
Contributor

yangfl commented Mar 13, 2024

No, the only available Android SDK on Debian is 23, unless server apk is not compiled at Debian side completely.

@CapitalF
Copy link

Okay, so what are Debian people supposed to do now? scrcpy in Debian Unstable is stuck on 1.25 from December 2022.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1042468

@rom1v
Copy link
Collaborator

rom1v commented Apr 14, 2024

@CapitalF An official scrcpy package in Debian requires that a recent android framework package (e.g. android-framework-34).

There "was" android-framework-23, which has been removed, and which is too old anyway.

Until that, there cannot be an official scrcpy Debian package, and people should follow these instructions to install on Debian (or build everything from sources).

@CapitalF
Copy link

people should follow these instructions to install on Debian (or build everything from sources).

Thank you for the very helpful hint! Looks like I will be building my own android tools and scrcpy here in the near future.

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

5 participants