在新建项目的时候出现了这个错误。
AS版本为3.6.1。
大致出错位置transforms-2下面的一个values.xml有问题。但这不是根本原因。
网上的说法是删除.gradle/.cache/transforms-2这个目录,然后清除缓存并重启。
但这个是无效的,可能情况不一样,我的是新建项目,老项目是没有问题的。
因为我修改了默认的新建项目模板,引用了很多库。这个错误的原因是库的版本出问题了。
大概率是appcompat的版本问题。修改成下面的依赖版本就没问题了。
当然大家遇到的错误可能不是这个库引起的,可能是别的库,这个需要自己排查了。
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}



