aapt: error: resource android:attr/colorerror not found. React Native Error Fix

By Rashid •  November 2nd, 2018 • 

You can come across aapt: error: resource android:attr/colorerror not found. error while building your react native Android app or while generating APK file from your React Native project. This issue occurs when third-party libraries use compileSdkVersion and buildToolsVersion less than 26.

You can solve this react native issue by forcing sub-projects to use SDK version greater than 26. Just open android/build.gradle file and add the following code inside allprojects tag.

allprojects {
    repositories {
        google()
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
    //add the folllowing lines to force libs to use recent buildtools
    subprojects {
        afterEvaluate {
            project ->
                if (project.hasProperty("android")) {
                    android {
                        compileSdkVersion = 27
                        buildToolsVersion = "27.0.3"
                    }
                }
        }
    }
}

 

Rashid

Keep Reading