简体   繁体   English

无法导入facebook sdk,与谷歌播放服务冲突

[英]Can't import facebook sdk, conflicting with google play services

I have an app that involves a tab layout. 我有一个涉及标签布局的应用程序。 On the third tab I have a Google Map, on the fifth tab I can share my whereabouts on the map in Facebook. 在第三个标签上我有一个谷歌地图,在第五个标签上,我可以在Facebook上分享我在地图上的行踪。 I imported Google Play Services for the Google Maps, however I am trying to import the Facebook SDK. 我为Google地图导入了Google Play服务,但我正在尝试导入Facebook SDK。 Then these errors pop up: 然后弹出这些错误:

[2013-10-17 11:58:48 - QuezonCityGuide] Found 2 versions of android-support-v4.jar in the dependency list,
[2013-10-17 11:58:48 - QuezonCityGuide] but not all the versions are identical (check is based on SHA-1 only at this time).
[2013-10-17 11:58:48 - QuezonCityGuide] All versions of the libraries must be the same at this time.
[2013-10-17 11:58:48 - QuezonCityGuide] Versions found are:
[2013-10-17 11:58:48 - QuezonCityGuide] Path:     C:\Users\user\workspace\QuezonCityGuide\libs\android-support-v4.jar
[2013-10-17 11:58:48 - QuezonCityGuide]     Length: 556198
[2013-10-17 11:58:48 - QuezonCityGuide]     SHA-1: 4a6be13368bb64c5a0b0460632d228a1a915f58f
[2013-10-17 11:58:48 - QuezonCityGuide] Path: C:\Users\user\Downloads\facebook-android-sdk-3.5.2\facebook-android-sdk-3.5.2\facebook\libs\android-support-v4.jar
[2013-10-17 11:58:48 - QuezonCityGuide]     Length: 349252
[2013-10-17 11:58:48 - QuezonCityGuide]     SHA-1: 612846c9857077a039b533718f72db3bc041d389
[2013-10-17 11:58:48 - QuezonCityGuide] Jar mismatch! Fix your dependencies

I'm trying to use the Facebook Share Dialog. 我正在尝试使用Facebook Share Dialog。 Can someone please help me? 有人可以帮帮我吗? Thanks! 谢谢!

只需用Facebook-SDK>libs文件夹中的android-support-v4.jar替换项目的android-support-v4.jar

Make sure you have not added the android-support-v4.jar library from your main project's libs folder. 确保您没有从主项目的libs文件夹中添加android-support-v4.jar库。 If you have done so then it will give library dependency error. 如果您已经这样做,那么它将给出库依赖性错误。 Because the Facebook SDK also contains the same library. 因为Facebook SDK也包含相同的库。

So you just have to add Facebook SDK as library in your project by right click Prefrence>Android>from tab click on Add... and select Facebook SDK. 所以你只需要在项目中添加Facebook SDK作为库,右键单击Prefrence>Android>from tab click on Add... and select Facebook SDK. Also remove your android-support-v4.jar from your build path if its referencing from your project. 如果它从您的项目引用,也从您的构建路径中删除您的android-support-v4.jar

I would suggest that you use the solution described in the accepted answer here: Facebook SDK for Android duplicate support library on dependencies 我建议您使用此处接受的答案中描述的解决方案: Facebook SDK for Android重复支持库的依赖项

This way you would have the latest version of the support library in both your projects. 这样,您可以在两个项目中使用最新版本的支持库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM