簡體   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