美文网首页
解决:Android Studio添加依赖时出现“Manifes

解决:Android Studio添加依赖时出现“Manifes

作者: Goorwl | 来源:发表于2017-01-08 20:28 被阅读0次
    • 原因:
      • 主程序module清单文件中,application节点的android:icon属性引用了@mipmap/ic_launcher图片资源;
      • 而依赖module的清单文件中,同样的android:icon属性却引用了@drawable/ic_launcher这个图片资源;
    • 命名空间xmlns:tools="http://schemas.android.com/tools"官方文档:
      • The manifest merger tool combines all XML elements from each file by following some merge heuristics and by obeying merge preferences that you have defined with special XML attributes. This page describes how manifest merging works and how you can apply merge preferences to resolve merge conflicts.【总结:这个命名空间就是用来解决合并项目或者导入第三方库的时候可能会发生的xml文件冲突的问题】

      • 节点tools:node="replace"介绍

        • Replace the lower-priority element completely. That is, if there is a matching element in the lower-priority manifest, ignore it and use this element exactly as it appears in this manifest.【完全取代低优先级元素,如果在低优先级清单文件中存在匹配的元素,忽略它并且使用同样的元素替代它】
      • 官方文档地址:https://developer.android.com/studio/build/manifest-merge.html

    • 解决方式:
      • 在清单文件中添加命名空间:xmlns:tools="http://schemas.android.com/tools"
      • application标签中添加属性:tools:replace="android:icon"
    • 图片演示:



      2017/1/8 20:26:59

    相关文章

      网友评论

          本文标题:解决:Android Studio添加依赖时出现“Manifes

          本文链接:https://www.haomeiwen.com/subject/ysqcbttx.html