Home > Software engineering >  Why compileSdkVersion is wrong when integrating React Native?
Why compileSdkVersion is wrong when integrating React Native?

Time:12-17

While integrating React Native into an existing Android project, we get the following error when we try to sync the project:

A problem occurred evaluating project ':react-native-restart'. Unsupported value: 28. Format must be one of:

  • android-31
  • android-31-ext2
  • android-T
  • vendorName:addonName:31

The error is thrown by node_modules/react-native-restart/android/build.gradle, on this line:

compileSdkVersion safeExtGet('compileSdkVersion')

In the Android project build.gradle we have:

compileSdkVersion 31
minSdkVersion 26
targetSdkVersion 31

Any idea?

CodePudding user response:

Because it is defined in a package level here https://github.com/avishayil/react-native-restart/blob/master/android/gradle.properties

compileSdkVersion=28
minSdkVersion=16
targetSdkVersion=28

You can change it in your node_modules and save changes using patch-package

https://github.com/ds300/patch-package

  • Related