当前位置: 首页 > 知识库问答 >
问题:

无法在我的项目中合并dex

窦彦君
2023-03-14

错误:任务“:app:TransformDexArchiveWithExternalLibsDexMergerForDebug”执行失败。

java.lang.RuntimeException:com.android.builder.dexing.DexArchivEmergerException:无法合并dex

我尝试了以下帖子推荐的每一个解决方案:

  1. 后1
  2. 职位2

这是我的应用程序Gradle:

apply plugin: 'com.android.application'
android
    {
        compileSdkVersion 27
        buildToolsVersion '27.0.3'
        defaultConfig
                {
                    applicationId "com.parsdigit.helsa"
                    manifestPlaceholders = [onesignal_app_id               : "4af7b2c1-a1a8-4b4a-ade3-d65289b38267",
                                            // Project number pulled from dashboard, local value is ignored.
                                            onesignal_google_project_number: "REMOTE"]
                    minSdkVersion 21
                    targetSdkVersion 27
                    versionCode 1
                    versionName "1.0"
                    vectorDrawables.useSupportLibrary = true
                    multiDexEnabled true
                }
        buildTypes
                {
                    release
                            {
                                minifyEnabled true
                                shrinkResources true
                                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                            }
                }
        packagingOptions
                {
                    exclude 'META-INF/DEPENDENCIES'
                    exclude 'META-INF/LICENSE'
                    exclude 'META-INF/LICENSE.txt'
                    exclude 'META-INF/license.txt'
                    exclude 'META-INF/NOTICE'
                    exclude 'META-INF/NOTICE.txt'
                    exclude 'META-INF/notice.txt'
                    exclude 'META-INF/ASL2.0'
                }
        lintOptions
                {
                    checkReleaseBuilds false
                }
        dexOptions
                {
                    preDexLibraries = false
                    javaMaxHeapSize "4g"
                }
    }
    dependencies
    {
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile('com.squareup.okhttp3:okhttp:3.+')
        compile 'com.android.support:multidex:1.0.2'
        compile 'com.android.support:design:27.1.0'
        compile 'com.android.support:appcompat-v7:27.1.0'
        compile 'com.android.support:recyclerview-v7:27.1.0'
        compile 'com.google.android.gms:play-services:11.8.0'
        compile 'com.google.android.gms:play-services-location:11.8.0'
        compile 'com.google.firebase:firebase-core:11.8.0'
        compile 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
        compile 'org.apache.httpcomponents:httpclient:4.5.4'
        compile 'com.google.maps.android:android-maps-utils:0.4.3'
        compile 'com.google.code.gson:gson:2.8.2'
        compile 'uk.co.chrisjenx:calligraphy:2.2.0'
        compile 'com.pixplicity.easyprefs:library:1.8.1@aar'
        compile 'gun0912.ted:tedpermission:1.0.3'
        compile 'com.kennyc:snackbar:2.5'
        compile 'me.itangqi.waveloadingview:library:0.3.5'
        compile 'com.daimajia.androidanimations:library:2.3@aar'
        compile 'com.fujiyuu75:sequent:0.2.1'
        compile 'com.akexorcist:RoundCornerProgressBar:2.0.3'
        compile 'pl.charmas.android:android-reactive-location:0.10@aar'
        compile 'io.reactivex:rxjava:1.2.0'
        compile 'me.zhanghai.android.materialratingbar:library:1.2.0'
        compile 'cn.lightsky.infiniteindicator:library:1.2.2'
        compile 'com.squareup.picasso:picasso:2.+'
        compile 'com.nineoldandroids:library:2.4.0'
        compile 'de.hdodenhof:circleimageview:2.2.0'
        compile 'com.github.wooplr:Spotlight:1.2.3'
        compile 'com.wang.avi:library:2.1.3'
        compile 'com.caverock:androidsvg:1.2.1'
        compile 'com.github.bumptech.glide:glide:3.8.0'
        compile project(':sidemenulibrary');
        compile('com.github.ozodrukh:CircularReveal:1.1.1@aar')
                {
                    transitive = true;
                }
        compile 'org.greenrobot:eventbus:3.0.0'
        compile 'com.nex3z:notification-badge:0.3.0'
        compile 'com.github.Shashank02051997:FancyGifDialog-Android:1.1'
        compile 'br.com.simplepass:loading-button-android:1.+'
        compile 'com.github.blennerSilva:AwesomeDialog:2.0.5'
        compile 'me.relex:circleindicator:1.2.2@aar'
        compile 'com.airbnb.android:lottie:2.2.5'
        compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
        compile 'com.github.RobertApikyan:SegmentedControl:release_1.0.1'
        compile 'com.github.skydoves:powermenu:2.0.1'
        compile 'com.otaliastudios:cameraview:1.4.1'
        compile 'com.mindorks:placeholderview:0.7.2'
        compile 'com.google.code.gson:gson:2.7'
        compile 'com.github.Mostafa-MA-Saleh:EditCredit:1.5.0'
        compile 'com.github.mreram:ShowCaseView:1.0.5'
        compile 'com.mohamadamin:persianmaterialdatetimepicker:1.2.1'
        compile 'com.alirezaafkar:sundatepicker:2.0.8'
    }

下面是我在我的项目中的一个库的分级:

    apply plugin: 'com.android.library'
    group='com.yalantis:sidemenu'
android {
compileSdkVersion 27
buildToolsVersion '27.0.2'
defaultConfig {
    minSdkVersion 21
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

            dependencies
                compile 'com.android.support:appcompat-v7:27.0.2'
    task androidJavadocs(type: Javadoc) {
        source = android.sourceSets.main.java.sourceFiles
}
task androidJavadocsJar(type: Jar) {
    classifier = 'javadoc'
    //basename = artifact_id
    from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar) {
    classifier = 'sources'
    //basename = artifact_id
    from android.sourceSets.main.java.sourceFiles
}
artifacts {
    //archives packageReleaseJar
    archives androidSourcesJar
    archives androidJavadocsJar
}
FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Helsa\android\app\build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':app'.
> java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'.
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:92)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:187)
        at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:192)
        at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:61)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
        at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:58)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:39)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
        at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:63)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.access$100(LifecycleProjectEvaluator.java:33)
        at org.gradle.configuration.project.LifecycleProjectEvaluator$ConfigureProject.run(LifecycleProjectEvaluator.java:103)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:49)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:651)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:133)
        at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
        at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:62)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38)
        at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuild.run(DefaultGradleLauncher.java:246)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
        at org.gradle.initialization.DefaultGradleLauncher.configureBuild(DefaultGradleLauncher.java:165)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:124)
        at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:107)
        at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:78)
        at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:75)
        at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
        at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100)
        at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:75)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
        at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:45)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:29)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:71)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:45)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:51)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:64)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:29)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:42)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:58)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:33)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: com.google.common.util.concurrent.ExecutionError: java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199)
        at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
        at org.gradle.api.internal.plugins.DefaultPluginRegistry.uncheckedGet(DefaultPluginRegistry.java:149)
        at org.gradle.api.internal.plugins.DefaultPluginRegistry.lookup(DefaultPluginRegistry.java:144)
        at org.gradle.api.internal.plugins.DefaultPluginRegistry.lookup(DefaultPluginRegistry.java:127)
        at org.gradle.api.internal.plugins.DefaultPluginRegistry.lookup(DefaultPluginRegistry.java:121)
        at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:121)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyType(DefaultObjectConfigurationAction.java:113)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:36)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:80)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:136)
        at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:46)
        at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.java:34)
        at org.gradle.api.Script$apply$0.callCurrent(Unknown Source)
        at build_7tk3isvg0ht17m1ll3oykzmdx.run(C:\Helsa\android\app\build.gradle:1)
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
        ... 93 more
Caused by: java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
        at org.gradle.api.internal.plugins.DefaultPluginRegistry$1.load(DefaultPluginRegistry.java:71)
        at org.gradle.api.internal.plugins.DefaultPluginRegistry$1.load(DefaultPluginRegistry.java:51)
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
        ... 110 more
  • 请访问https://help.gradle.org获取更多帮助

生成在2M%11s中失败

共有1个答案

吉嘉珍
2023-03-14

请按照以下步骤操作

    null
 类似资料:
  • 问题内容: 我有一个接收任务并将其放入频道的功能。每个任务都有ID,一些属性以及放置结果的通道。看起来像这样 另一个goroutine从通道中获取任务,对其进行处理,然后将结果放入任务的通道中 此代码可以正常工作。但是现在我要合并任务。任务处理是一项非常昂贵的操作,因此我希望一次处理具有相同ID的队列中的所有任务。我看到了两种方法。 首先,不要将具有相同ID的任务放入队列,因此,当现有任务到达时,

  • 我的项目有些问题。在Android Studio 3.0中,它运行良好,但当我更新到3.0.1时,我在合并dex时遇到了问题。 我清理和重建项目。我使用带依赖项的multiDexEnabled true 什么是错的: 错误:任务': app: transformDexArchiveWitExternalLibsDexMergerForDebug'执行失败。 Java语言lang.RuntimeEx

  • 我正在使用flutter来研发App。我在我的项目中添加了fire base,之后当我运行应用程序时,调试控制台中出现了一些错误。我删除了fire base库,但其他库再次出现错误。 注意:我不使用Android X 建筑格拉德尔: bulild.gradle(app) > 运行Gradle: ProcessException: Process"E:\MehrdadyOmidi\Project\f

  • 我无法打开recyclerview项目中的片段。当我点击项目中的按钮时,我得到了一条错误消息:对空对象引用的onEditClick(com.example.taskapprealm.edit.EditFragment)“。Null位于适配器内部。 活动中的方法: 和适配器中的onBindViewHolder: 接口: 日志:

  • 我试图建立一个具有以下依赖关系的应用程序。 这是我在红帽网站上找到的一个例子-http://www.jboss.org/quickstarts/eap/helloworld-jms/ 我正在使用Netbeans 8.0.2。(还在dos和eclipse中使用Maven命令进行了尝试)我在构建时遇到了一个错误,下面是相同的日志: 我可以在以下路径找到文件: https://maven.reposit

  • 我有两个代号为“一”的独立项目,它们都运行良好,现在我想将这两个项目合并为一个。我知道如何组合代码和类文件,但我想知道如何组合两个项目的文件,因为在一个文件,很难再次创建所有文件。请建议是否有任何方法我可以结合两个文件,或者我可以使用两个一个项目中的文件。e、 g。 项目1:名称:test1有主题。res文件和12个表格 项目2:名称:test2有主题。res文件和18表格 新项目:名称:Merg