-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[BUG]: :react-native-video:compileDebugJavaWithJavac because error: switch expressions are not supported in -source 11 #4252
Comments
Previous bot comment (click to expand)Thank you for your issue report. Please note that the following information is missing or incomplete:
Please update your issue with this information to help us address it more effectively.
There is a newer version of the library available. You are using version ^6.7.0, while the latest stable version is 6.7.0. Please update to the latest version and check if the issue still exists.
|
Thank you for your issue report. Please note that the following information is missing or incomplete:
Please update your issue with this information to help us address it more effectively.
|
which react native version do you use ? |
just for information, your comment is right: Here’s a summary of the relevant Java versions: Java 12: Introduced the new switch expression as a preview feature. |
React native is version 0.71.7. And so, it seems to be a error related directly to ExoPlayer. But it affects react-native-video in the matter that i can't compile app for android. Did i have to open a issue to google/ExoPlayer repo? Like i said, no issue about this i've found online, nor on react-native-video nor in Exoplayer repos. And neither in StackOverflow like sites...So i deduce that is a new error of some update in react-native-video or ExoPlayer |
This fixed for me: Updated(In ReactExoplayerView):
TO
Then did: |
Is solved. Thank you very much for help @Ajmal0197 |
I reopen this because you can track the fix for package. I can confirm that the solution is that of the user i thanked. Thanks again to everyone. |
I hade same issue, i'm not a fan of patch, the workaround that work for me was explicit define java version on I add this peace of code
|
This is a better solution. |
did you try to put
directly in the package ? I think it would be a better solution ?! |
I've patched this file - float speed = switch (which) {
- case 0 -> 0.5f;
- case 2 -> 1.5f;
- case 3 -> 2.0f;
- default -> 1.0f;
- };
+ float speed;
+ switch (which) {
+ case 0:
+ speed = 0.5f;
+ break;
+ case 2:
+ speed = 1.5f;
+ break;
+ case 3:
+ speed = 2.0f;
+ break;
+ default:
+ speed = 1.0f;
+ break;
+ } |
Version
6.7.0
What platforms are you having the problem on?
Android
System Version
Android
On what device are you experiencing the issue?
Real device
Architecture
New architecture with interop layer
What happened?
A strange bug caused by a "missing feature of java" cause this :react-native-video:compileDebugJavaWithJavac error:
/exoplayer/ReactExoplayerView.java:522: error: switch expressions are not supported in -source 11
and tell me to:
(use -source 14 or higher to enable switch rules)
I use Azul Zulu JDK 17 on a iMac. So it's really strange that is complaining about a source 11 error (assuming is intending Java 11)
java -version
openjdk version "17.0.11" 2024-04-16 LTS
OpenJDK Runtime Environment Zulu17.50+19-CA (build 17.0.11+9-LTS)
OpenJDK 64-Bit Server VM Zulu17.50+19-CA (build 17.0.11+9-LTS, mixed mode, sharing)
No bug has been reported nor in react-native-video nor in ExoPlayer repo
Reproduction Link
repository link
Reproduction
Step to reproduce this bug are:
Use react-native-video
Run react-native run-android, with Azul Zulu JDK 17
The text was updated successfully, but these errors were encountered: