Android studio Aapt.exe finished with non zero exit value 1

ぃ、小莉子 提交于 2020-01-25 23:41:04

问题


In My app I am using google play services and some others and all are working fine as expected. but when I comes towards the design side , I was asked to used the segmented control as we have in IOS 7. so for this I tired using this library.

But as i added this library and sync I got this error

Error:Execution failed for task ':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'' finished with non-zero exit value 1

And the Error message is this :

AGPBI: {"kind":"ERROR","text":"Attribute \"border_width\" has already been defined","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":""}

So I have no Idea what to replace and How to handle it. My case is different from others as others errors are just saying to remove or rename the drawables or resources of their app but in my app the conflicts is going between two libraries resources so How I am going to tackle this problem ? what is a solution of this? Please Help me.


回答1:


I had the same problem when using the android-segment-control custom view. I think the problem comes with the newer Build Tools version (mine is now 22.0.1) which brings some default border_width value.

To remove the custom border_width:

  • In the attrs.xml file remove the "border_with" attribute so only the following remains:

    <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>
    
  • In the SegmentedGroup.java file remove the "mMarginDp" variable so only the following remains:

    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();
    }
    


来源:https://stackoverflow.com/questions/31582664/android-studio-aapt-exe-finished-with-non-zero-exit-value-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!