繁体   English   中英

当我添加库时,Android Studio应用程序不想编译

[英]Android studio app does not want compile when I add libs

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

日志:

项目':app'中的配置'compile'已弃用。 请改用“实现”。 :app:buildInfoDebugLoader:app:preBuild UP-TO-DATE:app:preDebugBuild UP-TO-DATE:app:compileDebugAidl UP-TO-DATE:app:compileDebugRenderscript UP-TO-DATE:app:checkDebugManifest UP-TO-DATE: app:generateDebugBuildConfig UP-TO-DATE:app:prepareLintJar UP-TO-DATE:app:generateDebugResValues UP-TO-DATE:app:generateDebugResources UP-TO-DATE:app:mergeDebugResources UP-TO-DATE:app:create:DebugCompatibleScreenManifests UP- TO-DATE:app:processDebugManifest UP-TO-DATE:app:splitsDiscoveryTaskDebug UP-TO-DATE: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:packageInstantRunResourcesDebug UP-TO-DATE:app:checkManifestChangesDebug:app:transformClassesWithExtractJarsForDebug UP-TO-DATE :app:transformClassesWithInstantRunVerifierForDebug截止日期:app:transformClassesWithDependencyC heckerForDebug:应用:compileDebugNdk NO-SOURCE:应用:mergeDebugJniLibFolders UP-TO-DATE:应用程序:transformNativeLibsWithMergeJniLibsForDebug:应用:processDebugJavaRes NO-SOURCE:应用程序:transformResourcesWithMergeJavaResForDebug:应用程序:transformNativeLibsAndResourcesWithJavaResourcesVerifierForDebug:应用程序:transformClassesWithInstantRunForDebug:应用:transformClassesEnhancedWithInstantReloadDexForDebug UP-TO-DATE: app:incrementalDebugTasks:app:preColdswapDebug:app:fastDeployDebugExtractor UP-TO-DATE:app:generateDebugInstantRunAppInfo UP-TO-DATE:app:transformClassesWithInstantRunSlicerForDebug UP-TO-DATE:app:transformClassesWithDexBuilderForDebug:app:Trans:DiveBuilderForDebug

失败:构建失败,发生异常。

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

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

这是为我解决问题的原因:

  • 清洁
  • 重建

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

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

如果这不起作用:-参考此链接肯定会有所帮助!

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

android {
    defaultConfig {
    multiDexEnabled true
                  }
    }

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

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

看一下这个。 它还可以帮助您确定问题所在。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM