我不知道如何解决这个问题。它在许多活动中显示相同的错误。 如何解决?
先谢谢。
的xml:
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:descendantFocusability="blocksDescendants"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardBackgroundColor="@color/myTextPrimaryColor"
card_view:cardCornerRadius="10dp"
app:cardUseCompatPadding="true"
card_view:cardElevation="1dp"
card_view:cardUseCompatPadding="true"
android:id="@+id/cv"
>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<ImageView
android:layout_width="130dp"
android:layout_height="120dp"
android:layout_weight="0"
android:id="@+id/pimage"
android:src="@drawable/sliper"
android:focusable = "false"
android:focusableInTouchMode = "false"
android:layout_marginTop="15dp"
android:layout_marginRight="10dp" />
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/itemname"
android:textColor="@color/myNavigationColor"
android:id="@+id/itemname"
android:layout_marginTop="20dp"
android:textStyle="bold"
android:paddingRight="10dp" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="balck, 16gb"
android:textColor="@color/myNavigationColor"
android:id="@+id/aliasname"
android:layout_marginTop="10dp"
android:textStyle="bold" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/itemamount"
android:textColor="@color/myNavigationColor"
android:id="@+id/wishselling"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/eixstingamt"
android:textColor="@color/darkhash"
android:id="@+id/wishmrp"
android:layout_marginLeft="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/wishoffer"
android:layout_marginLeft="5dp"
android:textColor="@color/WishTextColor"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<RatingBar
android:id="@+id/rtbProductRating"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:numStars="5"
android:rating="3"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:isIndicator="true"
android:theme="@style/RatingBar"
style="?android:attr/ratingBarStyleSmall" />
<!-- <RatingBar android:id="@+id/ratingBar1"
style="@style/foodRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</RatingBar> -->
<!-- style="@style/foodRatingBar" style="@style/foodRatingBar"-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/rating"
android:textColor="@color/darkhash"
android:id="@+id/ratingtxt"
android:layout_marginLeft="15dp" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="15dp">
<ImageButton
android:layout_width="25dp"
android:layout_height="25dp"
android:id="@+id/likes"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:background="@drawable/ic_delete_sweep_black_24dp"
android:layout_gravity="right"
android:layout_marginRight="15dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
清单:
C: \Users\ admin\ AndroidStudioProjects\ shoppingdrawer\ app\ src\ main\ res\ layout\ activity_address__edit.xml
Error: (57) Error parsing XML: duplicate attribute
C: \Users\ admin\ AndroidStudioProjects\ shoppingdrawer\ app\ src\ main\ res\ layout\ activity_address_edit_.xml
Error: (56) Error parsing XML: duplicate attribute
C: \Users\ admin\ AndroidStudioProjects\ shoppingdrawer\ app\ src\ main\ res\ layout\ activity_delivery_.xml
Error: (52) Error parsing XML: duplicate attribute
C: \Users\ admin\ AndroidStudioProjects\ shoppingdrawer\ app\ src\ main\ res\ layout\ activity_delivery_2.xml
Error: (52) Error parsing XML: duplicate attribute
C: \Users\ admin\ AndroidStudioProjects\ shoppingdrawer\ app\ src\ main\ res\ layout\ addressdiplayrow.xml
Error: (9) Error parsing XML: duplicate attribute
C: \Users\ admin\ AndroidStudioProjects\ shoppingdrawer\ app\ src\ main\ res\ layout\ wishitemsrow.xml
Error: (12) Error parsing XML: duplicate attribute
Error: Execution failed
for task ':app:processReleaseResources'. >
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '
C: \Users\ admin\ AppData\ Local\ Android\ sdk\ build - tools\ 23.0 .3\ aapt.exe ''
finished with non - zero exit value 1
Information: BUILD FAILED
答案 0 :(得分:6)
问题在于这两行:
app:cardUseCompatPadding="true"
card_view:cardUseCompatPadding="true"
删除其中一个 ,然后修复它。
说明:尽管这两行看起来不同,但它们实际上是相同的,因为如果你看一下:
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
这两个名称空间被声明为相同的名称,这实际上意味着这两个名称空间引用相同的内容,因此两次声明相同的属性会使它成为重复,这是不允许的。