实现SeekArc时构建同步失败

时间:2018-04-14 11:29:27

标签: android android-studio gradle build

我试图将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

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

1 个答案:

答案 0 :(得分:2)

问题来自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