我添加lib

时间:2018-01-29 05:16:39

标签: java android

我使用来自appodeal的奖励视频制作了一款应用。一切都很好,但发生了一些事情,应用程序停止使用来自appodeal的libs编译,错误:Dex合并错误。出了什么问题?

日志:

  

项目':app'中的配置'compile'已弃用。使用   相反,'实施'。 :app:buildInfoDebugLoader:app:preBuild   最新消息:app:preDebugBuild UP-TO-DATE:app:compileDebugAidl   UP-TO-DATE:app:compileDebugRenderscript UP-TO-DATE   :app:checkDebugManifest UP-TO-DATE:app:generateDebugBuildConfig   最新消息:app:prepareLintJar UP-TO-DATE:app:generateDebugResValues   最新消息:app:generateDebugResources UP-TO-DATE   :app:mergeDebugResources UP-TO-DATE   :app:createDebugCompatibleScreenManifest UP-TO-DATE   :app:processDebugManifest UP-TO-DATE:app:splitsDiscoveryTaskDebug   最新消息:app:processDebugResources UP-TO-DATE   :app:generateDebugSources:app:javaPreCompileDebug   :app:compileDebugJavaWithJavac:app:mergeDebugShaders UP-TO-DATE   :app:compileDebugShaders UP-TO-DATE:app:generateDebugAssets   UP-TO-DATE:app:mergeDebugAssets UP-TO-DATE   :app:packageInstantRunResourcesDebug UP-TO-DATE   :应用:checkManifestChangesDebug   :app:transformClassesWithExtractJarsForDebug UP-TO-DATE   :app:transformClassesWithInstantRunVerifierForDebug UP-TO-DATE   :应用:transformClassesWithDependencyCheckerForDebug   :app:compileDebugNdk NO-SOURCE:app:mergeDebugJniLibFolders UP-TO-DATE   :应用:transformNativeLibsWithMergeJniLibsForDebug   :app:processDebugJavaRes NO-SOURCE   :应用:transformResourcesWithMergeJavaResForDebug   :应用:transformNativeLibsAndResourcesWithJavaResourcesVerifierForDebug   :应用:transformClassesWithInstantRunForDebug   :app:transformClassesEnhancedWithInstantReloadDexForDebug UP-TO-DATE   :app:incrementalDebugTasks:app:preColdswapDebug   :app:fastDeployDebugExtractor UP-TO-DATE   :app:generateDebugInstantRunAppInfo UP-TO-DATE   :app:transformClassesWithInstantRunSlicerForDebug UP-TO-DATE   :应用:transformClassesWithDexBuilderForDebug   :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED   :应用程序:buildInfoGeneratorDebug

     

失败:构建因异常而失败。

     

出了什么问题:任务执行失败   ':应用程序:transformDexArchiveWithExternalLibsDexMergerForDebug'。   了java.lang.RuntimeException:   com.android.builder.dexing.DexArchiveMergerException:无法合并   DEX

4 个答案:

答案 0 :(得分:0)

我更新Google Play服务时遇到了同样的问题。

以下是我解决问题的原因:

  • 清洁
  • 重建

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

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

如果这不起作用: - 请参阅此from a file,这肯定会有所帮助!!

答案 1 :(得分:0)

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

android {
    defaultConfig {
    multiDexEnabled true
                  }
    }

答案 2 :(得分:0)

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

答案 3 :(得分:0)

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

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