错误:配置'.aapt.v2.Aapt2Exception的资源'attr/orientation'的重复值异常:Android资源编译失败

错误:配置'.aapt.v2.Aapt2Exception的资源'attr/orientation'的重复值异常:Android资源编译失败

问题描述:

我有这个编译错误! 我在stackoverflow上检查了类似的问题,但它们都是关于不同的错误&amp ;;而不是"attr/orientation"和"配置,但是它们对我的问题没有作用! 我正在使用androidx库,kotlin,Gradle 4.10.1,

I've got this compile error! I checked similar problems on stackoverflow but all of them were about different errors & not " attr/orientation' with config '' ", but they didn't work for my problem! I'm using androidx library , kotlin ,Gradle 4.10.1 ,

我执行了以下步骤,但仍然没有结果:

I do these steps, but still no result:

1-清洁项目

2-重建

3-使缓存无效/重新启动

3- Invalidate caches / Restart

4-在该文件夹上创建了另一个attrs.xml文件:res-> values-v21

4- made another attrs.xml file on the folder : res->values-v21

5种其他方式...

5-so many other ways...

但是所有这些都失败了! 有解决办法吗?

but all of them just failed! Any solution?

我发现了问题,这是一个错误,我将其报告给了Google(b.android.com)&他们回答了

I find the problem, it is a bug and I reported it to Google ( b.android.com ) & they answered

是的,我们知道此问题,它将在下一个alpha版本中修复. 这是问题链接

Yep, we are aware of this issue, it will be fixed in the next alpha release. this is the : issue link

.

那么如何解决它: 在build.gradle(Module)中更新到库的alpha3版本时,我遇到了问题:

So how to solve it: I faced the problem when updated to alpha3 version of library in build.gradle (Module) :

  implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3' 

只需将其降级到较低版本:

Just downgrade it to lower version:

  implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' 

现在可以了.

问题是Constraintlayout:2.0.0-alpha3库和attrs.xml在编译时合并之间的冲突!

The problem was the conflict between constraintlayout:2.0.0-alpha3 library and attrs.xml merging on compile time!

对您来说,可能只是其他一些库之间的冲突(只需检查最近更新的库)

and for you it might be just conflicts between some other libraries ( just check last updated libraries )