react-native-video: [BUG]: :react-native-video:compileDebugJavaWithJavac because error: switch expressions are not supported in -source 11
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
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 19
I hade same issue, i’m not a fan of patch, the workaround that work for me was explicit define java version on
android/build.gradleI add this peace of code
i fixed it with downgrade to “react-native-video”: “6.6.4”
This fixed for me:
Updated(In ReactExoplayerView):
TO
Then did:
npx patch-package react-native-videoI’ve patched this file
node_modules/react-native-video/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java