Describe the bug
Android build fails after upgrading to react-native-zip-archive@7.1.0. The compilation crashes due to an invalid switch statement using a double type for compressionLevel.
To Reproduce
Steps to reproduce the behavior:
- Install
react-native-zip-archive@7.1.0
- Run
npx react-native run-android
- Build fails during
:react-native-zip-archive:compileDebugJavaWithJavac
Error
error: patterns in switch statements are a preview feature and are disabled by default.
switch (compressionLevel)
error: constant label of type int is not compatible with switch selector type double
Expected behavior
The Android build should complete successfully without compilation errors.
Actual behavior
Build fails due to invalid Java code:
switch (compressionLevel)
where compressionLevel is a double, which is not supported in Java switch.
Env (please complete the following information):
- Device: Android Emulator / Physical device
- OS: Android
- OS Version: Any
- React Native Version: (your version here)
- Package Version: 7.1.0
- Java Version: (e.g. 17)
Additional context
This issue is caused by the introduction of the compressionLevel parameter in v7.1.0.
A temporary fix is to cast the value to int:
switch ((int) compressionLevel)
However, this should be fixed in the library to ensure compatibility with standard Java compilation.
Describe the bug
Android build fails after upgrading to
react-native-zip-archive@7.1.0. The compilation crashes due to an invalidswitchstatement using adoubletype forcompressionLevel.To Reproduce
Steps to reproduce the behavior:
react-native-zip-archive@7.1.0npx react-native run-android:react-native-zip-archive:compileDebugJavaWithJavacError
Expected behavior
The Android build should complete successfully without compilation errors.
Actual behavior
Build fails due to invalid Java code:
where
compressionLevelis adouble, which is not supported in Javaswitch.Env (please complete the following information):
Additional context
This issue is caused by the introduction of the
compressionLevelparameter in v7.1.0.A temporary fix is to cast the value to
int:However, this should be fixed in the library to ensure compatibility with standard Java compilation.