【问题标题】:Error building app when I add dependency for PAYUMONEY sdk为 PAYUMONEY sdk 添加依赖项时构建应用程序时出错
【发布时间】:2019-02-14 13:26:21
【问题描述】:

我正在关注

build fail message:
Error:FAILURE: Build failed with an exception.

出了什么问题:

Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.

Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 13s

这是我的build.gradle文件代码:

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.bhashaproject.bhashas"
        minSdkVersion 20
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'

    compile 'com.android.support:appcompat-v7:27.1.1'
    compile 'com.android.support:support-v4:27.1.1'
    compile 'com.android.support:design:27.1.1'
    compile 'com.android.support:cardview-v7:27.1.1'
    compile 'com.android.support:support-vector-drawable:27.1.1'
    compile 'com.android.support:customtabs:27.1.1'
    compile 'org.apache.httpcomponents:httpcore:4.4.4'
    compile 'com.squareup.okhttp3:okhttp:3.9.0'
    compile 'com.android.support:design:27.1.1'
    compile 'com.android.support:support-v4:27.1.1'
    compile 'com.google.code.gson:gson:2.8.0'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.koushikdutta.ion:ion:2.1.7'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    compile 'com.android.support:recyclerview-v7:27.1.1'
    compile 'com.android.support:multidex:1.0.3'
    compile files('libs/httpmime-4.1.jar')
    compile files('libs/sinch-android-rtc-3.8.0-VIDEO-SNAPSHOT.jar')
    compile 'com.payumoney.sdkui:plug-n-play:1.4.1'
}
}

请帮忙。

【问题讨论】:

标签: android build.gradle


【解决方案1】:

您的 Build.gradle 中有重复的依赖项。

尝试删除这些:

compile 'com.android.support:design:27.1.1'
compile 'com.android.support:support-v4:27.1.1'

在这种情况下无需添加其他依赖项 (multidex)。这会增加项目大小等。老实说,我不会这样做,因为可以通过删除那些重复的依赖项来完成。


注意在新的 Android Studio 版本上compile 被替换为implementation,您最好检查一下:What's the difference between implementation and compile in Gradle?

【讨论】:

  • multiDexEnabled false 并删除它的依赖项怎么样?
猜你喜欢
  • 2018-04-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-02-24
  • 2021-01-13
  • 1970-01-01
  • 2016-02-19
相关资源
最近更新 更多