简体   繁体   English

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

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

I made an app with rewarded video from appodeal. 我用来自appodeal的奖励视频制作了一个app。 Everything was ok but something happened and the app stopped compiling with libs from appodeal, with error: Dex merge error. 一切正常,但是发生了一些事情,该应用程序停止使用来自appodeal的lib进行编译,并出现错误:Dex合并错误。 What is going wrong? 怎么了?

logs : 日志:

Configuration 'compile' in project ':app' is deprecated. 项目':app'中的配置'compile'已弃用。 Use 'implementation' instead. 请改用“实现”。 :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:createDebugCompatibleScreenManifests 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:mergeDebugAssets UP-TO-DATE :app:packageInstantRunResourcesDebug UP-TO-DATE :app:checkManifestChangesDebug :app:transformClassesWithExtractJarsForDebug UP-TO-DATE :app:transformClassesWithInstantRunVerifierForDebug UP-TO-DATE :app:transformClassesWithDependencyC :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 :app:compileDebugNdk NO-SOURCE :app:mergeDebugJniLibFolders UP-TO-DATE :app:transformNativeLibsWithMergeJniLibsForDebug :app:processDebugJavaRes NO-SOURCE :app:transformResourcesWithMergeJavaResForDebug :app:transformNativeLibsAndResourcesWithJavaResourcesVerifierForDebug :app: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 :app:transformClassesWithDexBuilderForDebug :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED :app:buildInfoGeneratorDebug 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

FAILURE: Build failed with an exception. 失败:构建失败,发生异常。

What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. 出了什么问题:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败。 java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex

I had the same problem when I updated my google play services. 更新Google Play服务时遇到了同样的问题。

Here is what solved the problem for me : 这是为我解决问题的原因:

  • Clean 清洁
  • Rebuild 重建

If that doesn't work try : 如果这样不起作用,请尝试:

  • File -> Invalidate Caches -> Invalidate Caches/Restart 文件->无效的缓存->无效的缓存/重新启动

If this didn't work : - Refer to this link it would surely help !! 如果这不起作用:-参考此链接肯定会有所帮助!

I had the same error. 我有同样的错误。 Adding this fixed it 添加此修复程序

android {
    defaultConfig {
    multiDexEnabled true
                  }
    }

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

Highly likely you have duplicate libs/classes in the project. 您很有可能在项目中有重复的库/类。 I suggest you check dependencies in build.gradle, check /libs folder. 我建议您检查build.gradle中的依赖项,检查/ libs文件夹。

Check this out. 看一下这个。 It also might help you to identify the problem you have. 它还可以帮助您确定问题所在。

暂无
暂无

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

相关问题 随机图像生成器应用程序不想在Android Studio 3.1.4上工作 - Random Image generator app does not want to work on android studio 3.1.4 Android Studio应用更改询问我是否要重新启动应用 - Android Studio Apply Changes asks if I want to Restart App 将SceneForm / ARCore添加到Gradle时,Android App无法编译 - Android App does not compile when SceneForm/ARCore added to Gradle Android Studio最新版本找不到参数目录库的编译方法 - Android Studio latest version could not find method compile for arguments directory libs 我想在Android Studio中退出Geofence时推送通知 - I want to push a notification when exiting a Geofence in android studio 当我在活动开始时点击垃圾邮件时,为什么我的 Android Studio 应用程序会崩溃? - Why does my Android studio App crash when I spam click at the beginning of an activity? 应用无法编译并无法在Android Studio中运行 - App fails to compile and run in Android Studio 我在项目中添加新库时相关库的协调版本 - coordination versions of related libs when i add new lib in project 如何使用Android Studio将iframe添加到活动中(我想从网站添加Google日历) - How to add iframe into an activity using android studio (I want to add google calender from a website) 当我从Android Studio启动它时,Android Studio应用程序可以运行,但从设备启动时却不能运行 - Android Studio app works when I launch it from Android Studio, but not when I launch from device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM