Я переношу свой проект в Gradle, когда наткнулся на эту ошибку:
Тип программы уже представлен: com.google.android.maps.GestureDetector $ GestureHandler
В проекте 2 модуля, 1 приложение, другое ядро.В приложении build.gradle я импортирую модуль core
и root /libs
(.jar, который я использовал в старой структуре проекта), в то время как ядру также нужен каталог / libs.
приложение build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
}
}
}
dependencies {
implementation fileTree(include: '*.jar', dir: "$rootProject.projectDir/libs")
implementation project(':core')
}
core build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
publishNonDefault true
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
}
}
}
dependencies {
implementation fileTree(include: '*.jar', dir: "$rootProject.projectDir/libs")
}
Подробная ошибка:
org.gradle.api.tasks.TaskExecutionException: не удалось выполнить задачу ': app: transformDexArchiveWithExternalLibsDexMergerForDebug'.в org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions (ExecuteActionsTaskExecuter.java:103) в org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute:gra.gra..api.internal..tasks.execution.ResolveTaskOutputCachingStateExecuter.execute (ResolveTaskOutputCachingStateExecuter.java:54) в org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute.a.as.gra..SkipEmptySourceFilesTaskExecuter.execute (SkipEmptySourceFilesTaskExecuter.java:101) в org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute (FinalizeInputFileProgra.jpg) org.jpg.api.internal..tasks.execution..ExecuteAtMostOnceTaskExecuter.execute (ExecuteAtMostOnceTaskExecuter.java:43) в org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute (CatchExceptionTaskExecuter.java:34Texas.Funk.grat.DefaultTaskGraphExecuter.java:256) в org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute (DefaultBuildOperationExecutor.java:336) в org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute (DefaultBuildOperationExecutor.java:328) по адресу org.gradle.internal.progress.DefaultBuildOperationExecutor.execute (DefaultBuildOperationExecutor.java:199) по адресу org.gradle.inefBackUgnв org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute (DefaultTaskGraphExecuter.java:249) в org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorktion.gras.ecuas.grag.jg ().DefaultTaskPlanExecutor $ TaskExecutorWorker.processTask (DefaultTaskPlanExecutor.java:123) в org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.access $ 200 (DefaultTaskPlan_Exception(DefaultTaskPlanExecutor.java:104) в org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute (DefaultTaskPlanExecutor.java:98) вorg.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute (DefaultTaskExecutionPlan.java:663) в org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask (DefaultTaskExecutionPlan.jkk.Secate.graf.Выполнить (DefaultTaskPlanExecutor.java:98) в org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process (DefaultTaskPlanExecutor.java:59) в org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute:grag.jpg (at) по умолчанию.execution.SelectedTaskExecutionAction.execute (SelectedTaskExecutionAction.java:37) в org.gradle.execution.DefaultBuildExecuter.execute (DefaultBuildExecuter.java:37) в org.gradle.execution.DefaultBuildExecuter.ju $ $ org.ju $ $.gradle.execution.DefaultBuildExecuter $ 1.proceed (DefaultBuildExecuter.java:43) в org.gradle.execution.DryRunBuildExecutionAction.execute (DryRunBuildExecutionAction.java:46) в org.gradle.execution.DefaultBuildExecuter.execute (DefaultBuildExecuter.java:37) в org.gradle.execution.DefaultBuildExecuter.execute (DefaultBuildExecuter.java:30) в org.gradle.initialization.DefaultGradleLauncher $ ExecuteTasks.run (Defaultuncrag): org.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute (DefaultBuildOperationExecutor.java:336) в org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execu.OwnExo.Ouист(DefaultBuildOperationExecutor.java:199) в org.gradle.internal.progress.DefaultBuildOperationExecutor.run (DefaultBuildOperationExecutor.java:110) в org.gradle.initialization.DefaultGradleLauncher.runTasks (DefaultGradleLialg2). Default.DefaultGradleLauncher.doBuildStages (DefaultGradleLauncher.java:140) в org.gradle.initialization.DefaultGradleLauncher.executeTasks (DefaultGradleLauncher.java:115) по адресу org.gradle.internal.invocation.GradleBuildController $ 1.call (GradleBuildController.java:78) по адресу org.gradle.internal.invocation.GradleBuildController $ 1.call (GradleBuildController).internal.work.: 75) в org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.run (ClientProvidedBuildActionRunner.java:62) в org.gradle.launcher.exec.ChainingBuildActionRunner.run (ChainingBuild orgAgn.grag35).launcher.exec.ChainingBuildActionRunner.run (ChainingBuildActionRunner.java:35) по адресу org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run (ValidatingBuildActionRunner.java:32) в среде org.gradleUuildActionRunner.java:43) по адресу org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute (DefaultBuildOperationExecutor.java:336) по адресу org.gradle.internal.progress.DefaultBuildOperationExecutor:.gradle.internal.progress..java: 40) в org.gradle.tooling.internal.provider.SubscribeableBuildActionRunner.run (SubscribeableBuildActionRunner.java:51) вorg.gradle.launcher.exec.InProcessBuildActionExecuter.execute (InProcessBuildActionExecuter.java:49) в org.gradle.launcher.exec.InProcessBuildActionExecuter.execute (InProcessBuildActionExecuter.java:32) в org.Secher.UcuEBuildTreeScopeBuildActionExecuter.java:39) в org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute (BuildTreeScopeBuildActionExecuter.java:25) в org.gradle.tooling.internal.provider.ildun.Exj.tooling.internal.provider.ContinuousBuildActionExecuter.execute (ContinuousBuildActionExecuter.java:53) при org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute (ServicesSetupBuildActionExecuter.java:57) при org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute (ServicesSetupBuildActionExecuter.java:32) в org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute (GradleThreadBuildActionExecuter.java:36) в org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute (GradleThreadBuildActionExecuter.java:25) в org.gradle.tooling.internal.provider.ParallelismConfision.gradle..StartParamsValidatingActionExecuter.execute (StartParamsValidatingActionExecuter.java:29) по адресу org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute (SessionFailureReportingActionExecure.jouringAjServer.ExterFort.js_Player.File.Player.File.Player.File.Player.File.Player.File.Player.File.Player.File.Player.File.Player.File.Player.Player.File.Player.Player.File.Player.Player.File.Port): 44) на орг.грале.инструмент.интернал.провider.SetupLoggingActionExecuter.execute (SetupLoggingActionExecuter.java:45) по адресу org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute (SetupLoggingActionExecuter.java:30) по адресу org.gradle.launcher.ExExecuteBuild.java:67) в org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute (BuildCommandOnly.java:36) в org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed: DaemonC122) в org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute (WatchForDisconnection.java:37) в org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.javag2: 12).gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute (ResetDeprecationLogger.java:26) в org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:12gra) org)..daemon.server.exec.RequestStopIfSingleUsedDaemon.execute (RequestStopIfSingleUsedDaemon.java: 34) в org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:122) в org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call (ForwardClientInput.java)) в org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call (ForwardClientInput.java:72) в org.gradle.util.Swapper.swap (Swapper.java:38) в org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute (ForwardClientInput.java:72) в org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:122) в org.gradle.launcher.daemon.ser.LogAndCheckHealth.execute (LogAndCheckHealth.java:55) в org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:122) вorg.gradle.launcher.daemon.server.exec.LogToClient.doBuild (LogToClient.java:62) в org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute (BuildCommandOnly.java:36) в org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:122) в org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild (EstablishBuildEnvironment.java:82delalagra) .grag.server.exec.BuildCommandOnly.execute (BuildCommandOnly.java:36) в org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:122) в org.gradle.launcher.daemon.sere.StartBuildOrRespondWithBusy $ 1.run (StartBuildOrRespondWithBusy.java:50) в org.gradle.launcher.daemon.server.DaemonStateCoordinator $ 1.run (DaemonStateCoordinator.java:295) дочерний методJava: 63) в org.gradle.internal.concurrent.ManagedExecutorImpl $ 1.run (ManagedExecutorImpl.java:46) в java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149) в java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:624) в org.gradle.internal.concableThunlThreadFactoryImpl.java:55) в java.lang.Thread.run (Thread.java:748), вызванный: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: ошибка при объединении архивов dex: F: \ Projetos\ SIAGN_Vendor \ app \ build \ промежуточные \ transforms \ dexBuilder \ debug \ 0.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные \ transforms \ dexBuilder \ debug \ 1.jar, F: \ Projetos \ SIAGN_Vendor \ app\ build \ промежуточные \ transforms \ dexBuilder \ debug \ 2.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные \ transforms \ dexBuilder \ debug \ 3.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные\ transforms \ dexBuilder \ debug \ 4.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ mediates \ transforms \ dexBuilder \ debug \ 5.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные \ transforms \ dex \Builder \ debug \ 6.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \ transforms \ dexBuilder \ debug \ 7.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \ transforms \ dexBuilder \ debug \8.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \ transforms \ dexBuilder \ debug \ 9.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \ transforms \ dexBuilder \ debug \ 12.jar,F: \ Projetos \ SIAGN_Vendor \ app \ build \ middleates \ transforms \ dexBuilder \ debug \ 13.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные \ transforms \ dexBuilder \ debug \ 14.jar, F: \ Projetos\ SIAGN_Vendor \ app \ build \ middleates \ transforms \ dexBuilder \ debug \ 15.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные \ transforms \ dexBuilder \ debug \ 16.jar, F: \ Projetos \ SIAGN_Vendor \ app\ build \ промежуточные звенья \ transforms \ dexBuilder \ debug \ 17.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \ transforms \ dexBuilder \ debug \ 18.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья\ transforms \ dexBuilder \ debug \ 19.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточныйs \ transforms \ dexBuilder \ debug \ 20.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \ transforms \ dexBuilder \ debug \ 21.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \ transforms \dexBuilder \ debug \ 22.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ middleates \ transforms \ dexBuilder \ debug \ 23.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ middleates \ transforms \ dexBuilder \ debug \24.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ middleates \ transforms \ dexBuilder \ debug \ 25.jar Тип программы уже представлен: com.google.android.maps.GestureDetector $ GestureHandler Подробнее о том, как решить проблему, можно узнать на странице https://developer.android.com/studio/build/dependencies#duplicate_classes. в com.android.builder.profile.Recorder $ Block.handleException (Recorder.java:55) в com.android.builder.profile.ThreadRecorder.record (ThreadRecorder.java:104) вcom.android.build.gradle.internal.pipeline.TransformTask.transform (TransformTask.java:230) в sun.reflect.NativeMethodAccessorImpl.invoke0 (родной метод) в sun.reflect.NativeMethodAccessorImpl.invod.jav): Nativesun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) в java.lang.reflect.Method.invoke (Method.java:498) в org.gradle.internal.reflect.JavaMethod.invojM (Java)в org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute (IncrementalTaskAction.java:50) в org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute (StandardTaskAction.java:39gra) 39.api.internal.project.taskfactory.StandardTaskAction.execute (StandardTaskAction.java:26) в org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 1.run (ExecuteActionsTaskExecuter.javag: atl.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute (DefaultBuildOperationExecutor.java: 336.internal.progress.DefaultBuildOperationExecutor.run (DefaultBuildOperationExecutor.java:110) в org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction (ExecuteActionsTaskExecuter.java:113.tas.in.in.in.in.ExecuteActionsTaskExecuter.executeActions (ExecuteActionsTaskExecuter.java:95) ... еще 108 Вызвано: com.android.builder.dexing.DexArchiveMergerException: ошибка при объединении dex-архивов: F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные_переменники\ debug \ 0.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ middleates \ transforms \ dexBuilder \ debug \ 1.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные \ transforms \ dexBuilder \ debug \ 2.jar, F: \ Projetos \ SIAGN_Vendor \ app\ build \ middleates \ transforms \ dexBuilder \ debug \ 3.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ middleates \ transforms \ dexBuilder \ debug \ 4.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточный тип\ transforms \ dexBuilder \ debug \ 5.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \mediates \ transforms \ dexBuilder \ debug \ 6.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные \ transforms \ dexBuilder\ debug \ 7.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные \ transforms \ dexBuilder \ debug \ 8.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные \ transforms \ dexBuilder \ debug \ 9.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \ transforms \ dexBuilder \ debug \ 12.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \ transforms \ dexBuilder \ debug \ 13.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \ transforms \ dexBuilder \ debug \ 14.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \ transforms \ dexBuilder \ debug \ 15.jar, F: \ Projetos \SIAGN_Vendor \ app \ build \ middleates \ transforms \ dexBuilder \ debug \ 16.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные \ transforms \ dexBuilder \ debug \ 17.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные \ transforms \ dexBuilder \ debug \ 18.jar, F: \ Projetos \ SIAGN_Vendor \ app \build \ промежуточные звенья \ transforms \ dexBuilder \ debug \ 19.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \ transforms \ dexBuilder \ debug \ 20.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \transforms \ dexBuilder \ debug \ 21.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \ transforms \ dexBuilder \ debug \ 22.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные звенья \ transforms \ dexBuilder \debug \ 23.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ middleates \ transforms \ dexBuilder \ debug \ 24.jar, F: \ Projetos \ SIAGN_Vendor \ app \ build \ промежуточные \ transforms \ dexBuilder \ debug \ 25.jar Тип программы уже представлен: com.google.android.maps.GestureDetector $ GestureHandler Узнайте, какрешите проблему в https://developer.android.com/studio/build/dependencies#duplicate_classes. в com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow (D8DexArchiveMerger.java:132) в com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives (D8Dexer.java).android.build.gradle.internal..gradle.internal.pipeline.TransformTask $ 2.call (TransformTask.java:239) в com.android.build.gradle.internal.pipeline.TransformTask $ 2.call (TransformTask.java:235) в com.android.builder.profile.ThreadRecorder.record (ThreadRecorder.java:102) ... еще 124 Причина: com.android.tools.r8.CompilationFailedException: не удалось завершить компиляцию в com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler (ExceptionUtils.Java: 65) на com.android.tools.r8.utils.ExceptionUtils.withD8CompilationHandler (за исключениемionUtils.java:43) на com.android.tools.r8.D8.run (D8.java:90) на com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives (D8DexArchiveMerger.java:115) ... еще 129 вызваноby: com.android.tools.r8.utils.AbortException: Ошибка: тип программы уже присутствует: com.google.android.maps.GestureDetector $ GestureHandler на com.android.tools.r8.utils.Reporter.failIfPendingErrors (Reporter.java: 116) на com.android.tools.r8.utils.Reporter.fatalError (Reporter.java:74) на com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler (ExceptionUtils.java:59) ... еще 132