android集成facebook第三方登录(踩坑)
集成的过程请看官网:https://developers.facebook.com/docs/facebook-login/android/ (需要科学上网)
- 如果你的应用没有上架,那么只能用你申请facebook开发者的那个账号登录。否则,如下图:
集成sdk的坑
2.1 如果你是下载下来的sdk,可能会碰到 Error:(2516) Error retrieving parent for item: No resource found that matches the given name ‘com_facebook_button’. 这个错。我曾试着解决,但最后都失败了,如果你有好的解决办法,可以留言。
2.2 因为上面的错误,我不得不选择使用在线依赖。官网是这样写的:
implementation是gradle 3.0后的用法,如果使用implementation报错,请将implementation改为api。2.3 如果遇到 :No resource found that matches the given name: attr ‘android:keyboardNavigationCluster’.这个报错。
请将 compileSdkVersion 设置为26以上。
2.4 如果遇到:com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: bolts/AggregateException.class
请将你的依赖改为
compile ('com.facebook.android:facebook-login:[4,5)')
{ exclude module: 'bolts-tasks'}
3.获取密钥散列的坑
3.1在获取秘钥的时候记得下载openssl库。
3.2如果填写了生成的秘钥但还是报如下错误:
解决办法:将箭头指向的秘钥手打到秘钥散列中。如下: