9

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)
2
  • Hi, I am facing the same issue past 10 days, can you please let me know how you get this done? Commented May 20, 2023 at 8:45
  • @RavindraNakrani i think i deleted node modules and package-lock.json, installed my modules back(with npm i) and did expo run:android if that doesn't work please comment below Commented May 20, 2023 at 18:01

2 Answers 2

0

It will solve by using [email protected] @react-native @android

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
0

The version of react-native-image-picker you're using requires newer Android SDK features than your project is configured for.

The error log points to symbols from Android 13 (API 33), like Build.VERSION_CODES.TIRAMISU and MediaStore.ACTION_PICK_IMAGES, which your build environment can't find. This means your project's compileSdkVersion is set to a value lower than 33.

Update your Android project's SDK versions. You need to target at least API level 33.

```
buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 21 
        compileSdkVersion = 33
        targetSdkVersion = 33
    }
}
```

Make sure you have the corresponding Android SDK Platform 33 and Build-Tools 33.0.0 installed via the Android Studio SDK Manager. Remember to clean the previous build artifacts.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.