Android Studio Gradle error “Multiple dex files define…”

后端 未结 5 1066
夕颜
夕颜 2020-12-10 04:35

My Project was working fine, when I have added facebook sdk into my project I have an error like this, I have tried so many ways to fix this, but I didn\'t. What should I do

5条回答
  •  情书的邮戳
    2020-12-10 05:23

    For me, I was adding Facebook SDK as a project, and set it as dependencies.

    However, the exclude work after i switching to use the maven source.

    I think it is for maven only, not for project dependencies? (please provide correct info if someone know about this)

    In other word, you can now delete the Facebook SDK project and files.

    remember to add

    repositories {
        mavenCentral()
    }
    

    if you weren't using maven.

    So the build.gradle look like this, I commented out the project way.

    repositories {
        mavenCentral()
    }
    dependencies {
        compile fileTree(dir: 'libs', include: '*.jar')
        compile project(':google-play-services_lib')
        compile ('com.facebook.android:facebook-android-sdk:3.23.0'){
            exclude module: 'bolts-android'
            exclude module: 'support-v4'
        }
    //    compile (project(':FacebookSDK')){
    //        exclude module: 'bolts-android'
    //        exclude module: 'support-v4'
    //    }
        compile (project(':UserVoiceSDK')){ exclude module: 'support-v4' }
    }
    

提交回复
热议问题