我正在尝试为项目使用SeekArc(https://github.com/neild001/SeekArc)。但是,当我尝试同步Gradle时,会被告知构建失败。当我在添加SeekArc的依赖项中删除该行时,构建再次成功。完整的错误消息如下。

  • 我正在添加jitbit作为回购。
  • 我尝试用compileimplementation替换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
    

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

    最佳答案

    问题来自library's manifest,其中包含一个带有

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

    什么时候应该合并 list 和库的 list ,所以与icon参数冲突。 (我们应该使用哪个图标?)

    该解决方案已由日志给出。

    在 list 文件中,添加工具 namespace 并指定替换保留字。替换将保留您应用 list 的属性。
    <manifest
        xmlns:tools="http://schemas.android.com/tools"
        ...
        >
       <application
           tools:replace="android:icon"
           ...
       />
    <manifest/>
    

    您可能还会遇到与标签相同的问题,并且替换看起来像tools:replace="android:icon,android:label"
    您可以获取有关合并功能的更多信息here

    关于android - 实现SeekArc时构建同步失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49830936/

    10-09 04:03