react-native-config: AAPT: error: resource android:attr/colorError not found.

I try to build using android studio but it fails resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found. pointing to the react-native-config. I know that it has to do with the fact that colorError i ssupported in android 26 or higher and this package is on 23, how could I fix this without downgrading?

About this issue

Most upvoted comments

Thanks @Summys Formatted code, place this inside allprojects {

    // force libs to use recent buildtools
    // https://github.com/luggit/react-native-config/issues/299
    subprojects {
        afterEvaluate {
            project ->
                if (project.hasProperty("android")) {
                    android {
                        compileSdkVersion = 27
                        buildToolsVersion = "27.0.3"
                    }
                }
        }
    }

By forcing other packages to use 27 Set this code in android/build.gradle

     subprojects {
         afterEvaluate {
             project ->
                 if (project.hasProperty("android")) {
                     android {
                         compileSdkVersion = 27
                         buildToolsVersion = "27.0.3"
                     }
                 }
         }
     }

And for react native v0.59+ update buildToolsVersion to 28

    subprojects {
        afterEvaluate {
            project ->
                if (project.hasProperty("android")) {
                    android {
                        compileSdkVersion = 28
                        buildToolsVersion = "28.0.3"
                    }
                }
        }
    }

If you are using RN 59 you need an updated version of @Summys and @Tommos0 's answers inside allprojects in build.gradle:

    subprojects {
        afterEvaluate {
            project ->
                if (project.hasProperty("android")) {
                    android {
                        compileSdkVersion = 28
                        buildToolsVersion = "28.0.3"
                    }
                }
        }
    }

thank @Tommos0 …God Bless You…