В проекте студии Android я добавил implementation 'com.google.cloud:google-cloud-language:1.40.0' в файл градиента приложения.

Это приводит к следующей ошибке при сборке:

org.gradle.api.tasks.TaskExecutionException: сбой выполнения для задачи ': app: transformResourcesWithMergeJavaResForDebug'. в org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions (ExecuteActionsTaskExecuter.java:103) в org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute (ExecuteActionsTaskExecuter.execute. .api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute (OutputDirectoryCreatingTaskExecuter.java:51) в org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute (SkipUpToDateTaskExecuter.execute) (SkipToDateTaskExecuter.execute) (SkipUpToDateTaskExecuter.execute. .tasks.execution.ResolveTaskOutputCachingStateExecuter.execute (ResolveTaskOutputCachingStateExecuter.java:54) в org.gradle.api.internal.tasks.execution. .SkipEmptySourceFilesTaskExecuter.execute (SkipEmptySourceFilesTaskExecuter.java:101) в org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute (FinalizeInputFilePro pertiesTaskExecuter.java:44) в org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute (CleanupStaleOutputsExecuter.java:91) в org.gradle.api.internal.tasks.execution.ResolveTask.execution.ResolveStateTask.execution. 62) в org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute (SkipTaskWithNoActionsExecuter.java:59) в org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecipTasks.execution.SkipOnlyIfTaskExecipTjavaecution. .gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute (ExecuteAtMostOnceTaskExecuter.java:43) в org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.executejava:gdleExceptionTaskExecuter.executejava: исключение 34 (Catchcception) или исключение GradleException. .taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker $ 1.run (DefaultTaskGraphExecuter.java:256) в org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker. выполнить (DefaultBuildOperationExecutor.java:336) в org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute (DefaultBuildOperationExecutor.java:328) в org.gradle.internal.internal.progress.DefaultBuildOperation.exe .gradle.internal.progress.DefaultBuildOperationExecutor.run (DefaultBuildOperationExecutor.java:110) в org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute (DefaultTaskdleGraphExecutergraph.exe или при запуске. .execute (DefaultTaskGraphExecuter.java:238) в org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.processTask (DefaultTaskPlanExecutor.java:123) в org $.gradleExecutor.java:123) в org $.gradle.execution.taskgraph.Executer.java: 79) в org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute (DefaultTaskPlanExecutor.java:104) по адресу org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker : 663) в org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask (DefaultTaskExecutionPlan.java:597) в org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorkdle.run (DefaultTask.internal) или в графе. concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute (ExecutorPolicy.java:63) в org.gradle.internal.concurrent.ManagedExecutorImpl $ 1.run (ManagedExecutorImpl.java:46) в java.utilThreadPread.concurrent.java:46 ) в java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:617) в org.gradle.internal.concurrent.ThreadFactoryImpl $ ManagedThreadRunnable.r un (ThreadFactoryImpl.java:55) в java.lang.Thread.run (Thread.java:745) Вызвано: com.android.builder.merge.DuplicateRelativeFileException: найдено несколько файлов с независимым от ОС путем 'META-INF / ЗАВИСИМОСТИ 'на

В чем причина этой ошибки и как ее исправить?

0
battery 5 Окт 2018 в 21:25

1 ответ

Лучший ответ

Вы должны использовать exclude (или pickFirst) в packagingOptions:

android {
    packagingOptions {
        exclude "META-INF/DEPENDENCIES"
    }
}
1
Martin Zeitler 6 Окт 2018 в 05:45