-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Maybe reflection is unneded here #3073
Comments
Shizuku uses this. Shortly: you can write some stubs for Android classes in some library and use it as |
Stale issue. |
Scrcpy already used the android framework jar for compiling. Reflection is used for hidden APIs (which have not the same signatures on all Android API versions or devices). |
The sense of the issue is to not use reflection at all. It is possible to use stubs (like this) with gradle's |
But sometimes, the function just does not exist on the device (or with a different signature). If you compile against a stub, it will fail to call it and crash the scrcpy server. Cf for example: scrcpy/server/src/main/java/com/genymobile/scrcpy/wrappers/ClipboardManager.java Lines 28 to 50 in 5764f47
So you can't "link" the methods at compile time. |
That happens only if you are using new API on old devices, like |
Sometimes, but not always:
|
In the case if you are calling non-existing method you will get the same |
In the case if you are calling non-existing method you will get the same In that case, it's a
On the positive side, the implementation of wrappers would be more readable. On the negative side:
|
Gradle allows us to add our jars to bootClasspath. At least I do not see if there is read-only or public modificator.
You can try to build a library containing Android classes (parts of them) and use it in main project.
The text was updated successfully, but these errors were encountered: