Take buildToolsVersion and compileSdkVersion from root project
myklosbotond opened this issue · comments
myklosbotond commented
Description
When using this lib and building for android, a warning is shown due to hardcoded buildToolsVersion
version in build.gradle#L16
clashing with newer Android Gradle Plugin.
What is the current behavior?
When building I get the following:
WARNING:: The specified Android SDK Build Tools version (29.0.3) is ignored, as it is below the minimum supported version (30.0.2) for Android Gradle Plugin 4.2.1.
Android SDK Build Tools 30.0.2 will be used.
To suppress this warning, remove "buildToolsVersion '29.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
WARNING:: The specified Android SDK Build Tools version (29.0.3) is ignored, as it is below the minimum supported version (30.0.2) for Android Gradle Plugin 4.2.1.
Android SDK Build Tools 30.0.2 will be used.
To suppress this warning, remove "buildToolsVersion '29.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
What is the expected behavior?
No warnings show up and outer config is respected.
What have you tried?
I tried applying the safeExtGet
approach that many libs use via patch-package
and it solved my problems.
What it boils down to:
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
android {
compileSdkVersion safeExtGet("compileSdkVersion", 30)
buildToolsVersion safeExtGet("buildToolsVersion", "29.0.3")
defaultConfig {
minSdkVersion 21
targetSdkVersion safeExtGet("targetSdkVersion", 30)
// ...
}
}
This way the outside config takes precedence, but the old value is still kept as a fallback.
Version info
@react-native-community/progress-view: 1.3.1
react-native: 0.65.1