androidreact-nativesdkreact-native-image-crop-picker

react-native-image-crop-picker build issue for android


I'm trying to install react-native-image-crop-picker for my react-native app. For IOS it build without an issue. Android built fails with this issue.

> Task :react-native-image-crop-picker:compileDebugJavaWithJavac FAILED
375 actionable tasks: 355 executed, 20 up-to-date
...
/Users/*project_directory*/node_modules/react-native-image-crop-picker/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java:406: error: cannot find symbol
        permissionsCheck(activity, promise, Collections.singletonList(Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU ? Manifest.permission.WRITE_EXTERNAL_STORAGE : Manifest.permission.READ_MEDIA_IMAGES), new Callable<Void>() {
                                                                                                                 ^
  symbol:   variable TIRAMISU
  location: class VERSION_CODES
/Users/*project_directory*/node_modules/react-native-image-crop-picker/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java:406: error: cannot find symbol
        permissionsCheck(activity, promise, Collections.singletonList(Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU ? Manifest.permission.WRITE_EXTERNAL_STORAGE : Manifest.permission.READ_MEDIA_IMAGES), new Callable<Void>() {

My built tool versions are here. "react-native": "0.69.9", "react-native-image-crop-picker": "^0.39.0"

buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31

According to this issue in github, there is a suggestion to change compileSdkVersion and buildToolsVersion to 33. Changing sdk versions to 33 worked for me also. But in my case, I need to hold the sdk version 31. Is there is a way to fix this issue without changing the sdk version?


Solution

  • Reducing the version from "react-native-image-crop-picker": "^0.39.0" to "react-native-image-crop-picker": "^0.38.1" worked for me