Gradle error after including facebook sdk

后端 未结 1 538
面向向阳花
面向向阳花 2021-01-12 09:39

Immediately after adding the facebook-audience-network-sdk in my gradle file, I started getting errors, the first one I fixed my adding multiDexEnabled true, after that I ke

相关标签:
1条回答
  • 2021-01-12 10:13

    I finally got rid of the error. So the problem was with the com.google.android.gms:play-services-ads-8.1.0. You can see from the image it was 8.1.0 and other play dependencies were 8.4.0.

    So these two ways worked. One was to change the dependency into

     compile ('com.facebook.android:facebook-android-sdk:4.10.0'){
        exclude group:"com.google.android.gms"
     }
    

    But the issue with this is that, it could be a problem since in my other dependencies I didn't have play-services-ads:8.4.0'

    So the way I solved this was just add a single line

      compile 'com.google.android.gms:play-services-ads:8.4.0'
    

    This way everything worked perfectly, because when gradle compiled it automatically replaced the 8.1.0 into the 8.4.0

    Here is my final dependencies list that worked

    dependencies {
         compile fileTree(dir: 'libs', include: ['*.jar'])
         testCompile 'junit:junit:4.12'
         compile 'com.android.support:appcompat-v7:23.1.1'
         compile 'com.mcxiaoke.volley:library:1.0.17'
         compile 'com.android.support:recyclerview-v7:23.1.1'
         compile 'com.android.support:design:23.1.1'
    
         compile 'com.google.android.gms:play-services-gcm:8.4.0'
         compile 'com.google.android.gms:play-services-auth:8.4.0'
         compile 'com.google.android.gms:play-services-analytics:8.4.0'
    
         compile 'com.google.android.gms:play-services-ads:8.4.0'
    
         compile 'com.facebook.android:facebook-android-sdk:4.10.0'
         compile 'com.facebook.android:audience-network-sdk:4.10.0'
         compile 'joda-time:joda-time:2.7'
    

    }

    0 讨论(0)
提交回复
热议问题