【问题标题】:Android studio Aapt.exe finished with non zero exit value 1Android studio Aapt.exe 以非零退出值 1 完成
【发布时间】:2015-07-23 08:58:25
【问题描述】:

在我的应用程序中,我正在使用谷歌播放服务和其他一些服务,并且都按预期正常工作。但是当我谈到设计方面时,我被要求使用我们在 IOS 7 中使用的分段控制。所以为此我厌倦了使用这个库。

但是当我添加这个库并同步时,我得到了这个错误

错误:任务 ':app:processDebugResources' 执行失败。

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\Stacy Data\AndroidStudio\SDK\build-tools\22.0.1\aapt.exe'' 完成 非零退出值 1

错误信息是这样的:

AGPBI: {"kind":"ERROR","text":"属性 \"border_width\" 已经 到过 已定义","sourcePath":"C:\Users\stacy\Desktop\premioApp\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-wallet\7.5.0\res\values \wallet_colors.xml","position":{"startLine":1},"original":""}

所以我不知道要替换什么以及如何处理它。我的情况与其他人不同,因为其他错误只是说要删除或重命名他们应用程序的可绘制对象或资源,但在我的应用程序中,两个库资源之间存在冲突,所以我将如何解决这个问题?什么是解决方案?请帮我。

【问题讨论】:

  • 如果库是开源的,你可以随时修改 values 资源来防止这种情况发生,但是你需要维护这个库的一个分支并不断更新它。你需要查看 @987654322 @border_width属性的库源目录
  • 还有其他解决方案吗?
  • 我猜不是.. android 问题跟踪器上有一个关于此的问题,但它已关闭,说它按预期工作.. Link to the issue
  • 你试过使用最新的builToolVersion和gradle版本
  • 我使用的是这个工具版本22.0.1

标签: android android-studio google-play-services android-library


【解决方案1】:

我在使用android-segment-control custom view 时遇到了同样的问题。我认为问题出在较新的 Build Tools 版本(我的现在是 22.0.1)上,它带来了一些默认的border_width 值。

移除自定义的border_width:

  • attrs.xml 文件中删除“border_with”属性,因此只剩下以下内容:

    <declare-styleable name="SegmentedGroup">
        <attr name="corner_radius" format="dimension" />
        <attr name="tint_color" format="color" />
        <attr name="checked_text_color" format="color" />
    </declare-styleable>
    
  • SegmentedGroup.java 文件中删除“mMarginDp”变量,因此只剩下以下内容:

    try {
    
        mCornerRadius = typedArray.getDimension(
                R.styleable.SegmentedGroup_corner_radius,
                getResources().getDimension(R.dimen.radio_button_conner_radius));
    
        mTintColor = typedArray.getColor(
                R.styleable.SegmentedGroup_tint_color,
                getResources().getColor(R.color.radio_button_selected_color));
    
        mCheckedTextColor = typedArray.getColor(
                R.styleable.SegmentedGroup_checked_text_color,
                getResources().getColor(android.R.color.white));
    
    } finally {
        typedArray.recycle();
    }
    

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-16
    相关资源
    最近更新 更多