【问题标题】:Android studio app does not want compile when I add libs当我添加库时,Android Studio 应用程序不想编译
【发布时间】:2018-01-29 05:16:39
【问题描述】:

我使用来自 appodeal 的奖励视频制作了一个应用。一切正常,但发生了一些事情,应用程序停止使用来自 appodeal 的库进行编译,出现错误:Dex 合并错误。出了什么问题?

日志:

项目 ':app' 中的配置 'compile' 已弃用。采用 而是“实施”。 :app:buildInfoDebugLoader :app:preBuild 最新:app:preDebugBuild 最新:app:compileDebugAidl 最新:app:compileDebugRenderscript 最新 :app:checkDebugManifest UP-TO-DATE :app:generateDebugBuildConfig 最新:app:prepareLintJar 最新:app:generateDebugResValues 最新:app:generateDebugResources 最新 :app:mergeDebugResources 最新 :app:createDebugCompatibleScreenManifests 最新 :app:processDebugManifest UP-TO-DATE :app:splitsDiscoveryTaskDebug 最新:app:processDebugResources 最新 :app:generateDebugSources :app:javaPreCompileDebug :app:compileDebugJavaWithJavac :app:mergeDebugShaders 最新 :app:compileDebugShaders UP-TO-DATE :app:generateDebugAssets 最新:app:mergeDebugAssets 最新 :app:packageInstantRunResourcesDebug UP-TO-DATE :app:checkManifestChangesDebug :app:transformClassesWithExtractJarsForDebug 最新 :app:transformClassesWithInstantRunVerifierForDebug 最新 :app:transformClassesWithDependencyCheckerForDebug :app:compileDebugNdk 无源 :app:mergeDebugJniLibFolders 最新 :app:transformNativeLibsWithMergeJniLibsForDebug :app:processDebugJavaRes 无源 :app:transformResourcesWithMergeJavaResForDebug :app:transformNativeLibsAndResourcesWithJavaResourcesVerifierForDebug :app:transformClassesWithInstantRunForDebug :app:transformClassesEnhancedWithInstantReloadDexForDebug UP-TO-DATE :app:incrementalDebugTasks :app:preColdswapDebug :app:fastDeployDebugExtractor 最新 :app:generateDebugInstantRunAppInfo UP-TO-DATE :app:transformClassesWithInstantRunSlicerForDebug 最新 :app:transformClassesWithDexBuilderForDebug :app:transformDexArchiveWithExternalLibsDexMergerForDebug 失败 :app:buildInfoGeneratorDebug

FAILURE:构建失败并出现异常。

出了什么问题:任务执行失败 ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'。 java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException:无法合并 索引

【问题讨论】:

  • 能否请您发布Logcat 错误
  • 这里是:错误:任务 ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' 的执行失败。 > java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: 无法合并 dex
  • 您可以先使用搜索这里的错误。此链接link 可能会对您有所帮助
  • 显示完整错误。它通常包含有关究竟是什么错误的详细信息。
  • 我不能将它粘贴到评论中,所以它会在答案中

标签: java android


【解决方案1】:

我在更新我的 google play 服务时遇到了同样的问题。

这就是为我解决问题的方法:

  • 干净
  • 重建

如果这不起作用,请尝试:

  • 文件 -> 使缓存无效 -> 使缓存无效/重新启动

如果这不起作用: - 参考这个link肯定会有帮助!!

【讨论】:

  • 不,它对我没有帮助,还有其他解决方法吗?
【解决方案2】:

我有同样的错误。添加这个修复它

android {
    defaultConfig {
    multiDexEnabled true
                  }
    }

【讨论】:

  • 你能发布你的 gradle 文件吗?并告诉我您使用的是哪个版本的 Android Studio?
【解决方案3】:

好的,所以对我来说最简单的方法就是创建新项目并从有错误的项目中导入所有内容,然后一切都可以正常工作:multiDexEnabled 或 project clean。

【讨论】:

    【解决方案4】:

    您很可能在项目中有重复的库/类。我建议您检查 build.gradle 中的依赖项,检查 /libs 文件夹。

    Check this out. It also might help you to identify the problem you have.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多