我不知道如何解决此问题。 API 28,NDK 20,JAVA 8,Gradle 5.1.1。我有几个模块的项目。在transformDexArchiveWithExternalLibsDexMergerForDebug任务上生成应用程序时出现问题。我有应用程序模块,以及四个依赖的模块,每个模块都有实现SAUtils.jar。
implementation files('libs/SAUtils.jar')
它包含产生错误的类:
AGPBI: {"kind":"error","text":"Program type already present: com.stargaze.Utils$1","sources":[{}],"tool":"D8"}
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Program type already present: com.stargaze.Utils$1
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.```
I tried multidex enabled
Change compile sdk versions
change "implementation" to "api"