引起原因:com.android.builder.merge.DuplicateRelativeFileException:找到了多个文件,这些文件具有与操作系统无关的路径'res / values / values.xml'

时间:2019-11-21 11:29:19

标签: android gradle build.gradle android-studio-3.5

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':libraries:PDFViewCtrlTools:mergeDebugJavaResource'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:151)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:148)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:141)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)

在我的缓存文件夹中,我得到了多个values.xml文件,这些文件是自动生成的。我尝试了在gradle文件中的PackagingOptions中排除'res / values / values.xml'的解决方案。我还在清单文件中应用了tools:node =“ merge”,请给我一个适当的解决方案,以便我可以构建apk

1 个答案:

答案 0 :(得分:0)

在分析了多种解决方案之后,我通过将下面的行放在gradle.properties文件中解决了该错误

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -Duser.country=US -Duser.language=en

而且只有上述行不能解决您的问题,然后将Gradle版本降级为3.4.2版本