草庐IT

android - 生成签名 APK - 错误 :(57) Error parsing XML: duplicate attribute in cardview?

coder 2024-07-03 原文

我不知道如何解决这个问题。它在许多 Activity 中显示出相同的错误。 如何解决?

提前致谢。

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>

list :

 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

最佳答案

问题是这两行:

    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"

这两个命名空间被声明为同一个命名空间,这实际上意味着这两个命名空间指的是同一事物,因此两次声明同一属性使其成为重复的,这是不允许的。

关于android - 生成签名 APK - 错误 :(57) Error parsing XML: duplicate attribute in cardview?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38409790/

有关android - 生成签名 APK - 错误 :(57) Error parsing XML: duplicate attribute in cardview?的更多相关文章

  1. ruby - 使用 RubyZip 生成 ZIP 文件时设置压缩级别 - 2

    我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看ruby​​zip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d

  2. ruby-on-rails - Rails 常用字符串(用于通知和错误信息等) - 2

    大约一年前,我决定确保每个包含非唯一文本的Flash通知都将从模块中的方法中获取文本。我这样做的最初原因是为了避免一遍又一遍地输入相同的字符串。如果我想更改措辞,我可以在一个地方轻松完成,而且一遍又一遍地重复同一件事而出现拼写错误的可能性也会降低。我最终得到的是这样的:moduleMessagesdefformat_error_messages(errors)errors.map{|attribute,message|"Error:#{attribute.to_s.titleize}#{message}."}enddeferror_message_could_not_find(obje

  3. ruby - 在 jRuby 中使用 'fork' 生成进程的替代方案? - 2

    在MRIRuby中我可以这样做:deftransferinternal_server=self.init_serverpid=forkdointernal_server.runend#Maketheserverprocessrunindependently.Process.detach(pid)internal_client=self.init_client#Dootherstuffwithconnectingtointernal_server...internal_client.post('somedata')ensure#KillserverProcess.kill('KILL',

  4. ruby - 如何使用 Ruby aws/s3 Gem 生成安全 URL 以从 s3 下载文件 - 2

    我正在编写一个小脚本来定位aws存储桶中的特定文件,并创建一个临时验证的url以发送给同事。(理想情况下,这将创建类似于在控制台上右键单击存储桶中的文件并复制链接地址的结果)。我研究过回形针,它似乎不符合这个标准,但我可能只是不知道它的全部功能。我尝试了以下方法:defauthenticated_url(file_name,bucket)AWS::S3::S3Object.url_for(file_name,bucket,:secure=>true,:expires=>20*60)end产生这种类型的结果:...-1.amazonaws.com/file_path/file.zip.A

  5. ruby-on-rails - 迷你测试错误 : "NameError: uninitialized constant" - 2

    我遵循MichaelHartl的“RubyonRails教程:学习Web开发”,并创建了检查用户名和电子邮件长度有效性的测试(名称最多50个字符,电子邮件最多255个字符)。test/helpers/application_helper_test.rb的内容是:require'test_helper'classApplicationHelperTest在运行bundleexecraketest时,所有测试都通过了,但我看到以下消息在最后被标记为错误:ERROR["test_full_title_helper",ApplicationHelperTest,1.820016791]test

  6. ruby-on-rails - 如何在 Rails View 上显示错误消息? - 2

    我是rails的新手,想在form字段上应用验证。myviewsnew.html.erb.....模拟.rbclassSimulation{:in=>1..25,:message=>'Therowmustbebetween1and25'}end模拟Controller.rbclassSimulationsController我想检查模型类中row字段的整数范围,如果不在范围内则返回错误信息。我可以检查上面代码的范围,但无法返回错误消息提前致谢 最佳答案 关键是您使用的是模型表单,一种显示ActiveRecord模型实例属性的表单。c

  7. 使用 ACL 调用 upload_file 时出现 Ruby S3 "Access Denied"错误 - 2

    我正在尝试编写一个将文件上传到AWS并公开该文件的Ruby脚本。我做了以下事情:s3=Aws::S3::Resource.new(credentials:Aws::Credentials.new(KEY,SECRET),region:'us-west-2')obj=s3.bucket('stg-db').object('key')obj.upload_file(filename)这似乎工作正常,除了该文件不是公开可用的,而且我无法获得它的公共(public)URL。但是当我登录到S3时,我可以正常查看我的文件。为了使其公开可用,我将最后一行更改为obj.upload_file(file

  8. ruby-on-rails - 错误 : Error installing pg: ERROR: Failed to build gem native extension - 2

    我克隆了一个rails仓库,我现在正尝试捆绑安装背景:OSXElCapitanruby2.2.3p173(2015-08-18修订版51636)[x86_64-darwin15]rails-v在您的Gemfile中列出的或native可用的任何gem源中找不到gem'pg(>=0)ruby​​'。运行bundleinstall以安装缺少的gem。bundleinstallFetchinggemmetadatafromhttps://rubygems.org/............Fetchingversionmetadatafromhttps://rubygems.org/...Fe

  9. ruby - #之间? Cooper 的 *Beginning Ruby* 中的错误或异常 - 2

    在Cooper的书BeginningRuby中,第166页有一个我无法重现的示例。classSongincludeComparableattr_accessor:lengthdef(other)@lengthother.lengthenddefinitialize(song_name,length)@song_name=song_name@length=lengthendenda=Song.new('Rockaroundtheclock',143)b=Song.new('BohemianRhapsody',544)c=Song.new('MinuteWaltz',60)a.betwee

  10. ruby-on-rails - 每次我尝试部署时,我都会得到 - (gcloud.preview.app.deploy) 错误响应 : [4] DEADLINE_EXCEEDED - 2

    我是Google云的新手,我正在尝试对其进行首次部署。我的第一个部署是RubyonRails项目。我基本上是在关注thisguideinthegoogleclouddocumentation.唯一的区别是我使用的是我自己的项目,而不是他们提供的“helloworld”项目。这是我的app.yaml文件runtime:customvm:trueentrypoint:bundleexecrackup-p8080-Eproductionconfig.ruresources:cpu:0.5memory_gb:1.3disk_size_gb:10当我转到我的项目目录并运行gcloudprevie

随机推荐