6

When trying to run my project on my windows computer it is not working, it works on my macOS but when running it on windows it throws the following errors:

Task :react-native-image-picker:compileDebugJavaWithJavac FAILED
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
                                                           ^
  symbol:   variable TIRAMISU
  location: class VERSION_CODES

Running it with npx react-native run-android

build.gradle has the following:


buildscript {
    ext {
        buildToolsVersion = "30.0.3"
        minSdkVersion = 30
        compileSdkVersion = 30
        targetSdkVersion = 30
                ndkVersion = "20.1.5948944"
    }

Have been trying to change the number with everything I have installed, 29,30,31,and 33 minSdk, buildTools, compile, and targeted nothing is working.

Currently, have node 14 and JDK 11

Error changes when I use 33 to the following one:

 Task :react-native-webview:compileDebugJavaWithJavac FAILED

Have already tried multiple times ./gradlew clean

Someone knows what's going on? what am I missing?

Nibras Shami
  • 144
  • 2
  • 14
JoseGE
  • 105
  • 1
  • 5

4 Answers4

7

I downgrade version of react-native-image-picker to 0.38.1, works for me

Mohammad
  • 86
  • 4
1

Downgrade might work but you can also try to upgrade to the latest version. In my case, apparently, npm installed version 4.10.3 when the latest version is 5.3.1. just write:

npm install react-native-image-picker@latest
Mercy Ademiju
  • 25
  • 1
  • 5
0
  1. Check if both mac & windows have same java version by running command java -version

  2. If no, change the version of java in windows like as in mac then, clean and rebuild

  3. If yes, check if one of this this solution works :

Thanhal P A
  • 4,097
  • 3
  • 18
  • 38
-2

In my app, the error was fixed by fixing the version of the library in this way: 'react-native-image-picker': '4.6.0', removing the ^ from 'react-native-image-picker': '^4.6.0'. After that, run yarn install or npm install

devtucuju
  • 1
  • 4
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 24 '23 at 13:23