版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/the_old_boy/article/details/81806848


    情景:在GitHub上找到了一个符合自己要求的开源项目,兴致冲冲的新建了一个测试项目导进去,成功了,没有错误,于是开始导入自己真正的项目中,结果报错了。一脸惊奇!!想想应该是和我项目的那些地方冲突了。仔细分析后发现果真
    错误如下:

    1. error: duplicate value for resource 'attr/hintColor' with config ''.
    2. Message{kind=ERROR, text=error: duplicate value for resource 'attr/hintColor' with config ''., sources=[E:\Android\Gradle_cache\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\09daf1d29ecbe0c64746345503b6473a\res\values\values.xml], original message=, tool name=Optional.of(AAPT)}

    error: duplicate value for resource ‘attr/hintColor’ with config ”. 大概意思就是这个资源“attr/hintColor”和配置文件的值重复了
    于是我来到了attr文件找到了 hintColor
    [转]导入开源包错误: duplicate value for resource 'attr/xxx' with config ''. - 图1
    把 hintColor 改为 hint_Color
    再次运行,ok,解决了
    【原因分析】
    我猜这个问题是因为 配置文件中也有一个叫hintColor的属性 ,而我又定义了一个同名的属性,因此造成了重复。
    【解决方法】
    在文件attrs文件中,找到hintColor,并修改为hint_color(只要不是hintColor都行)