error: style attribute 'attr/colorPrimary' not found

Make sure you have not missed appcompat implementation in build.gradle(app)

implementation ‘com.android.support:appcompat-v7:28.0.0’

or

implementation 'androidx.appcompat:appcompat:1.2.0'

if using androidx


This error commonly shows up when

androidx.appcompat:appcompat

and

com.google.android.material:material

versions do not match. Check whether you updated one and not the other


Had this in a library module, which suddenly stopped resolving the theme.

dependencies {
    implementation "com.google.android.material:material:1.3.0"
}