I'm working on a React Native application and I'm getting an error when compiling Android linked to the react-native-reanimated library or the Java version. Here are the details :
My versions :
- React native : 0.72.3
- react-native-reanimated : 3.9.0-rc.1
- Gradle : 8.0.1
- Kotlin : 1.8.10
- Groovy : 3.0.13
- Plugin Android Gradle : 7.4.2
- JVM : 17.0.10
- Java : 17
This is the error I get when I try to build :
/Users/me/Documents/Projects/my-project/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java:440: error: switch rules are not supported in -source 11 case "opacity" -> { ^ (use -source 14 or higher to enable switch rules)
/Users/me/Documents/Projects/my-project/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java:356: error: pattern matching in instanceof is not supported in -source 11 if (props.get(Snapshot.TRANSFORM_MATRIX) instanceof ReadableNativeArray matrixArray) { ^ (use -source 16 or higher to enable pattern matching in instanceof)
Steps I tried :
Gradle configuration : I added this in android/app/build.gradle, but nothing changed, it didn't fix my problem :
android { compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 } }
Cleaning and reconstruction :
I ran ./gradlew clean in the android directory.
I rebuilt with npx react-native run-android.
Questions :
How can this problem be resolved so that the project uses Java 17?
Is it possible that incompatibilities in my dependencies are preventing the Java version from being updated correctly?
Is there a specific version of the library that could correct this?
Thanks in advance !
I'm working on a React Native application and I'm getting an error when compiling Android linked to the react-native-reanimated library or the Java version. Here are the details :
My versions :
- React native : 0.72.3
- react-native-reanimated : 3.9.0-rc.1
- Gradle : 8.0.1
- Kotlin : 1.8.10
- Groovy : 3.0.13
- Plugin Android Gradle : 7.4.2
- JVM : 17.0.10
- Java : 17
This is the error I get when I try to build :
/Users/me/Documents/Projects/my-project/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java:440: error: switch rules are not supported in -source 11 case "opacity" -> { ^ (use -source 14 or higher to enable switch rules)
/Users/me/Documents/Projects/my-project/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java:356: error: pattern matching in instanceof is not supported in -source 11 if (props.get(Snapshot.TRANSFORM_MATRIX) instanceof ReadableNativeArray matrixArray) { ^ (use -source 16 or higher to enable pattern matching in instanceof)
Steps I tried :
Gradle configuration : I added this in android/app/build.gradle, but nothing changed, it didn't fix my problem :
android { compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 } }
Cleaning and reconstruction :
I ran ./gradlew clean in the android directory.
I rebuilt with npx react-native run-android.
Questions :
How can this problem be resolved so that the project uses Java 17?
Is it possible that incompatibilities in my dependencies are preventing the Java version from being updated correctly?
Is there a specific version of the library that could correct this?
Thanks in advance !
Share Improve this question edited Nov 28, 2024 at 9:27 HugoTek asked Nov 20, 2024 at 15:12 HugoTekHugoTek 616 bronze badges1 Answer
Reset to default 0I fixed it, just change on my package.json my version of react-native-reanimated :
"^3.9.0-rc.1"
to
"3.9.0-rc.1"
I delete the "^".
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742351186a4427548.html
评论列表(0条)