我在Android studio 0.4.3中有以下错误,
Execution failed for task ':MyAppName:mergeDebugResources'.
> /my project path/src/main/res/values-sw720dp/refs.xml: Error: Duplicate resources:
/my project path/src/main/res/values-sw720dp/refs.xml:layout-sw720dp/activity_configuration, /my project path/src/main/res/layout-sw720dp/activity_configuration.xml:layout-sw720dp/activity_configuration
RES /值-sw720dp / refs.xml
<resources>
<!--
Layout alias to replace the single-pane version of the layout with a
two-pane version on Large screens.
For more on layout aliases, see:
http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
-->
<item name="activity_mymap" type="layout">@layout/activity_mymap_twopane</item>
<item name="activity_configuration" type="layout">@layout/activity_configuration_twopane</item>
</resources>
RES /布局sw720dp / activity_configuration.xml
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/configuration_list"
android:name="com.myWebsite.myApp.configurations.ConfigurationListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="16dp"
tools:context="com.myWebsite.myApp.configurations.ConfigurationActivity"
tools:layout="@android:layout/list_content" />
答案 0 :(得分:0)
您已在同一目录中创建了与现有资源具有相同ID的别名 - 您已从布局XML文件中获取 layout-sw720dp / activity_configuration 资源,并且在< b> refs.xml 文件,您在同一文件夹中创建ID为activity_configuration
的别名。您可以为别名指定其他ID,也可以删除 layout-sw720dp 文件夹中的冗余资源。
我不清楚你需要别名 - 看起来你应该把布局的双窗格版本放在 layout-sw720dp 文件夹中,其ID与用于较小屏幕的单窗格版本(activity_configuration
),而不使用资源别名的额外间接。该文件的小屏幕单窗格版本将进入 layout / activity_configuration 。