Gradle sync fails after adding Fresco library giving error: Attribute "viewAspectRatio" has already been defined
When I add Fresco(0.5.3) to my Gradle file in Android studio project, Gradle sync fails pointing to my app's colors.xml file. The error is
Error:(2) Attribute "viewAspectRatio" has already been defined
My Colors.xml doesn't any attribute named "viewAspectRatio".
The other libraries I am using are:
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'de.greenrobot:greendao:1.3.7'
compile 'com.afollestad:material-dialogs:0.7.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.code.gson:gson:2.3.1'
Sadly, XML attributes on Android need to be globally unique. That's a fundamental design flaw if you ask me, but there is little we can do about it (other than perhaps prefixing all of our attributes, sigh).
That being said, some other library defines an attribute with the same name (viewAspectRatio) as Fresco.
You can either remove one of those libraries, or, you can fork Fresco and rename that attribute.