error: duplicate value for resource 'attr/orientation' with config '' .aapt.v2.Aapt2Exception: Android resource compilation failed

三世轮回 提交于 2020-01-29 06:08:04

问题


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- Clean Project

2- Rebuild

3- Invalidate caches / Restart

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

5-so many other ways...

but all of them just failed! Any solution?


回答1:


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

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

.

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' 

and now it's ok.

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 )




回答2:


It happens if you are you have migrate to Androidx and you add android.support library. Just try to find Androidx library for the android.support library you are using. For example. Change

implementation 'com.android.support:cardview-v7:28.0.0'

To

implementation 'androidx.cardview:cardview:1.0.0'



来源:https://stackoverflow.com/questions/53895569/error-duplicate-value-for-resource-attr-orientation-with-config-aapt-v2-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!