react-native-picker / picker

Picker is a cross-platform UI component for selecting an item from a list of options.
MIT License
1.53k stars 289 forks source link

Error after npm run android #557

Closed AlexDes closed 8 months ago

AlexDes commented 8 months ago

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 D:\dev\PrismaProject\node_modules\@react-native-picker\picker\android\src\main\java\com\reactnativecommunity\picker\ReactPickerLocalData.java:3: error: class, interface, or enum expected
public record ReactPickerLocalData(int height) { ^ D:\dev\PrismaProject\node_modules\@react-native-picker\picker\android\src\main\java\com\reactnativecommunity\picker\ReactPickerLocalData.java:6: error: class, interface, or enum expected
public boolean equals(Object o) { ^ D:\dev\PrismaProject\node_modules\@react-native-picker\picker\android\src\main\java\com\reactnativecommunity\picker\ReactPickerLocalData.java:8: error: class, interface, or enum expected
if (o == null || getClass() != o.getClass()) return false; ^ D:\dev\PrismaProject\node_modules\@react-native-picker\picker\android\src\main\java\com\reactnativecommunity\picker\ReactPickerLocalData.java:9: error: class, interface, or enum expected
ReactPickerLocalData that = (ReactPickerLocalData) o; ^ D:\dev\PrismaProject\node_modules\@react-native-picker\picker\android\src\main\java\com\reactnativecommunity\picker\ReactPickerLocalData.java:10: error: class, interface, or enum expected
return height == that.height; ^ D:\dev\PrismaProject\node_modules\@react-native-picker\picker\android\src\main\java\com\reactnativecommunity\picker\ReactPickerLocalData.java:11: error: class, interface, or enum expected
} ^ D:\dev\PrismaProject\node_modules\@react-native-picker\picker\android\src\main\java\com\reactnativecommunity\picker\ReactPickerLocalData.java:14: error: class, interface, or enum expected
public String toString() { ^ D:\dev\PrismaProject\node_modules\@react-native-picker\picker\android\src\main\java\com\reactnativecommunity\picker\ReactPickerLocalData.java:18: error: class, interface, or enum expected
} ^ 8 errors

short-dsb commented 8 months ago

This is because record was added in JDK 14. If you’re using an earlier version of Java, you’ll see this error.

Prior to React Native 0.73 (which suggests JDK 17), the recommended JDK was 11. It seems v2.7.0 of @react-native-picker/picker is not compatible with React Native 0.72 and earlier.

Naturalclar commented 8 months ago

:tada: This issue has been resolved in version 2.7.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: