[英]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:在将 React Native 集成到现有 Android 项目时,我们在尝试同步项目时收到以下错误:
A problem occurred evaluating project ':react-native-restart'.评估项目“:react-native-restart”时出现问题。 Unsupported value: 28. Format must be one of:不支持的值:28。格式必须是以下之一:
- android-31 android-31
- android-31-ext2 android-31-ext2
- android-T机器人-T
- vendorName:addonName:31供应商名称:插件名称:31
The error is thrown by node_modules/react-native-restart/android/build.gradle
, on this line:该错误由node_modules/react-native-restart/android/build.gradle
,在这一行:
compileSdkVersion safeExtGet('compileSdkVersion')
In the Android project build.gradle
we have:在 Android 项目build.gradle
,我们有:
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因为它是在包级别定义的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您可以在 node_modules 中更改它并使用 patch-package 保存更改
https://github.com/ds300/patch-package https://github.com/ds300/patch-package
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.