代码之家  ›  专栏  ›  技术社区  ›  Jon Goe

实现SeekArc时生成同步失败

  •  1
  • Jon Goe  · 技术社区  · 6 年前

    我想用SeekArc( https://github.com/neild001/SeekArc )对于项目。然而,当我尝试同步Gradle时,我被告知构建失败。当我删除依赖项中添加SeekArc的行时,构建再次成功。下面是完整的错误消息。

    • 我将jitbit添加为回购。
    • 我试过更换 compile 具有 implementation api

    Configuration on demand is an incubating feature.
    :app:preBuild UP-TO-DATE
    :app:preDebugBuild UP-TO-DATE
    :app:compileDebugAidl UP-TO-DATE
    :app:compileDebugRenderscript UP-TO-DATE
    :app:checkDebugManifest UP-TO-DATE
    :app:generateDebugBuildConfig UP-TO-DATE
    :app:prepareLintJar UP-TO-DATE
    :app:mainApkListPersistenceDebug UP-TO-DATE
    :app:generateDebugResValues UP-TO-DATE
    :app:generateDebugResources UP-TO-DATE
    :app:mergeDebugResources UP-TO-DATE
    :app:createDebugCompatibleScreenManifests UP-TO-DATE
    C:\Users\Me\AndroidStudioProjects\CommentsList\app\src\main\AndroidManifest.xml:7:9-43 Error:
        Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:7:9-43
        is also present at [com.github.Triggertrap:SeekArc:v1.1] AndroidManifest.xml:36:9-45 value=(@drawable/ic_launcher).
        Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.
    :app:processDebugManifest
    
    See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
    
    :app:processDebugManifest FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':app:processDebugManifest'.
    > Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:7:9-43
        is also present at [com.github.Triggertrap:SeekArc:v1.1] AndroidManifest.xml:36:9-45 value=(@drawable/ic_launcher).
        Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 1s
    11 actionable tasks: 1 executed, 10 up-to-date
    

    不知道该怎么办,如有任何帮助,将不胜感激!谢谢

    1 回复  |  直到 6 年前
        1
  •  2
  •   xiaomi    6 年前

    问题来自 library's manifest 其中包含一个应用程序节点

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
    >
    

    何时合并清单和库的清单,与icon参数冲突。(我们应该使用哪个图标?)

    日志中已经给出了解决方案。

    在清单文件中,添加工具名称空间并指定替换保留字。替换将保留应用程序清单的属性。

    <manifest 
        xmlns:tools="http://schemas.android.com/tools"
        ...
        >
       <application 
           tools:replace="android:icon"       
           ...
       />
    <manifest/>
    

    您很可能也会遇到标签的相同问题,替换将如下所示 tools:replace="android:icon,android:label"

    您可以获得更多信息 here 关于合并函数。