Android Studio Error Duplicate Resource Android Studio Error Duplicate Resource xml xml

Android Studio Error Duplicate Resource


You have the same resource style/AppTheme in two files, values/styles.xml and values/themes_apptheme.xml. Rename or remove the other.


After using Android Studio to create a new empty Activity using the new Activity wizard, the layout's XML file res/layout/myactivity_layout.xml was auto-generated, but Android Studio ALSO silently added /res/values/dimens.xml.

I already have a /res/values/dimen.xml file where I defined my various dimensions.

Android Studio added 2 new dimension keys to these files (without checking for conflicts) and sure enough, the keys for the 2 new dimensions were already defined in my dimen.xml file, so my Gradle build failed.

I assume the reason Android Studio added dimens.xml is because it didn't recognize my dimen.xml file existed. And the reason Android Studio auto-added new dimensions to dimens.xml is to adhere to Android's style conventions for Material Design (which I'm not adhering to for my project).

I would much prefer if Android Studio did not auto-generate problems without checking first!

I removed the extraneously added dimens.xml files and must now either rename my dimen.xml to dimens.xml or never use the new Activity Wizard again. Thanks Android.