简体   繁体   中英

Why compileSdkVersion is wrong when integrating React Native?

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM