I have a project that I was giving to update the UI , but anytime I run the app with npx react-native run android it gives the error:
Task :react-native-image-picker:compileDebugJavaWithJavac FAILED
This is the full error below:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
302 actionable tasks: 2 executed, 300 up-to-date
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
C:\Users\CURTIS\Downloads\efik\node_modules\react-native-image-picker\android\src\main\java\com\imagepicker\ImagePickerModule.java:135: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
^
symbol: variable TIRAMISU
location: class VERSION_CODES
C:\Users\CURTIS\Downloads\efik\node_modules\react-native-image-picker\android\src\main\java\com\imagepicker\ImagePickerModule.java:143: error: cannot find symbol
libraryIntent = new Intent(MediaStore.ACTION_PICK_IMAGES);
^
symbol: variable ACTION_PICK_IMAGES
location: class MediaStore
C:\Users\CURTIS\Downloads\efik\node_modules\react-native-image-picker\android\src\main\java\com\imagepicker\ImagePickerModule.java:147: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
^
symbol: variable TIRAMISU
location: class VERSION_CODES
C:\Users\CURTIS\Downloads\efik\node_modules\react-native-image-picker\android\src\main\java\com\imagepicker\ImagePickerModule.java:152: error: cannot find symbol
if (selectionLimit == 0) maxNum = MediaStore.getPickImagesMaxLimit();
^
symbol: method getPickImagesMaxLimit()
location: class MediaStore
C:\Users\CURTIS\Downloads\efik\node_modules\react-native-image-picker\android\src\main\java\com\imagepicker\ImagePickerModule.java:153: error: cannot find symbol
libraryIntent.putExtra(MediaStore.EXTRA_PICK_IMAGES_MAX, maxNum);
^
symbol: variable EXTRA_PICK_IMAGES_MAX
location: class MediaStore
C:\Users\CURTIS\Downloads\efik\node_modules\react-native-image-picker\android\src\main\java\com\imagepicker\ImagePickerModule.java:162: error: cannot find symbol
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
^
symbol: variable TIRAMISU
location: class VERSION_CODES
6 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-image-picker:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 58s
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
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
C:\Users\CURTIS\Downloads\efik\node_modules\react-native-image-picker\android\src\main\java\com\imagepicker\ImagePickerModule.java:135: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
^
symbol: variable TIRAMISU
location: class VERSION_CODES
C:\Users\CURTIS\Downloads\efik\node_modules\react-native-image-picker\android\src\main\java\com\imagepicker\ImagePickerModule.java:143: error: cannot find symbol
libraryIntent = new Intent(MediaStore.ACTION_PICK_IMAGES);
^
symbol: variable ACTION_PICK_IMAGES
location: class MediaStore
C:\Users\CURTIS\Downloads\efik\node_modules\react-native-image-picker\android\src\main\java\com\imagepicker\ImagePickerModule.java:147: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
^
symbol: variable TIRAMISU
location: class VERSION_CODES
C:\Users\CURTIS\Downloads\efik\node_modules\react-native-image-picker\android\src\main\java\com\imagepicker\ImagePickerModule.java:152: error: cannot find symbol
if (selectionLimit == 0) maxNum = MediaStore.getPickImagesMaxLimit();
^
symbol: method getPickImagesMaxLimit()
location: class MediaStore
C:\Users\CURTIS\Downloads\efik\node_modules\react-native-image-picker\android\src\main\java\com\imagepicker\ImagePickerModule.java:153: error: cannot find symbol
libraryIntent.putExtra(MediaStore.EXTRA_PICK_IMAGES_MAX, maxNum);
^
symbol: variable EXTRA_PICK_IMAGES_MAX
location: class MediaStore
C:\Users\CURTIS\Downloads\efik\node_modules\react-native-image-picker\android\src\main\java\com\imagepicker\ImagePickerModule.java:162: error: cannot find symbol
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
^
symbol: variable TIRAMISU
location: class VERSION_CODES
6 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-image-picker:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 58s
at makeError (C:\Users\CURTIS\Downloads\efik\node_modules\execa\index.js:174:9)
at C:\Users\CURTIS\Downloads\efik\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Users\CURTIS\Downloads\efik\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\CURTIS\Downloads\efik\node_modules\@react-native-community\cli\build\index.js:192:9)
expo run:androidif that doesn't work please comment below