gradle error DexException after adding facebook library

﹥>﹥吖頭↗ 提交于 2019-12-24 02:59:39

问题


after I added the fb library in the gradle dependences:

dependencies {
    compile 'com.mixpanel.android:mixpanel-android:4.5.2'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.facebook.android:facebook-android-sdk:3.22.0'
}

I started getting an error on gradle build:

dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;

thanks


回答1:


com.facebook.android:facebook-android-sdk:3.22.0This usually occurs because of a library getting referred to twice in the dependencies.

You can run the following command to see all the dependent libraries:

gradle -q dependencies 

You may need to do something like this to prevent the support library from being included twice:

*** Updated to reflect comment

compile ('com.facebook.android:facebook-android-sdk:3.22.0'){
        exclude module: 'support-v4'
}

See this related question: Building OutsystemsNow for android on Android Studio getting dexException



来源:https://stackoverflow.com/questions/28149146/gradle-error-dexexception-after-adding-facebook-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!