Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take buildToolsVersion and compileSdkVersion from root project #74

Open
myklosbotond opened this issue Sep 21, 2021 · 0 comments
Open

Comments

@myklosbotond
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant