-2

我在我的应用程序的 build.gradle 文件的依赖项部分中添加了 Lyft android SDK 依赖项,如下所示

implementation "com.lyft:lyft-android-sdk:1.0.3

但是在移动设备上运行应用程序时出现以下错误:-

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDevDebug'.
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org

BUILD FAILED in 3m 33s

我尝试通过在 app gradle 的默认配置中添加multiDexEnabled true来解决上述问题,但它不起作用。

我正在使用 Android Studio 3.0.1 和 gradle 4.1 版本。

4

1 回答 1

1

我通过在 gradle 构建过程中启用堆栈跟踪并查看堆栈跟踪日志来进一步调查问题。

在堆栈跟踪中,我发现 org.jetbrains.annotations 包中有一个重复的类,它来自两个不同的依赖模块。一个依赖模块来自 kotlin 依赖,一个来自 lyft sdk 依赖模块。所以我在 build.gradle 中添加了 Lyft sdk 依赖项,如下所示,它对我有用。

implementation ("com.lyft:lyft-android-sdk:1.0.3"){
        exclude group: 'org.jetbrains', module:'annotations-java5'
    }
于 2018-02-27T13:45:15.227 回答