当我为PAYUMONEY SDK添加依赖项时,构建应用程序时出错

时间:2018-09-10 06:31:22

标签: android build.gradle

我正在关注

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'
}
}

请帮助。

1 个答案:

答案 0 :(得分:1)

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

尝试删除这些:

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

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


请注意,在新的Android Studio版本上,compileimplementation取代了,您最好检查一下:What's the difference between implementation and compile in Gradle?

相关问题