简体   繁体   English

Android Facebook SDK V4.0无法正常工作

[英]android facebook sdk v4.0 not working

Using Eclipse. 使用Eclipse。 SDK Manager is up to date. SDK Manager是最新的。 How ever when I import the facebook SDK to my workspace. 如何将facebook SDK导入我的工作区。 It throws lots of error. 它引发很多错误。

facebook-android-sdk-4.0.0\\facebook\\res\\values\\messenger_button_styles.xml:66: error: Error: No resource found that matches the given name: attr 'android:textAllCaps'. I removed it from values. 我从值中删除了它。

The import android.support cannot be resolved I added support v4 '<>' operator is not allowed for source level below 1.7 If i change the complier it gives kitkat below error. The import android.support cannot be resolved我添加了支持v4 '<>' operator is not allowed for source level below 1.7如果我更改了编译器,它将给出kitkat以下错误。 When I do insert inferred type arguments It goes away. 当我insert inferred type arguments它就消失了。 Afterwards it gives bolts library error. 之后,它给出了螺栓库错误。 Then I downloaded bolts and import it too. 然后,我下载了螺栓并也将其导入。 How ever this time bolts gives a lots of that I can't fixed further. 这次螺栓如何提供了很多我无法修复的信息。 Any suggestions for it. 任何建议。

The Facebook Android SDK v4.0 uses Gradle as it's build and dependency management system. Facebook Android SDK v4.0使用Gradle作为其构建和依赖性管理系统。 http://marketplace.eclipse.org/content/gradle-integration-eclipse-44 is available for Eclipse. http://marketplace.eclipse.org/content/gradle-integration-eclipse-44可用于Eclipse。 Also http://eclipse.org/m2e/ can be used for integrating with the Facebook's maven artifact: http://search.maven.org/#artifactdetails|com.facebook.android|facebook-android-sdk|4.0.0| 也可以使用http://eclipse.org/m2e/与Facebook的maven工件集成: http ://search.maven.org/#artifactdetails|com.facebook.android|facebook-android-sdk|4.0.0 |

The android:textAllCaps issue occurs if you're targeting a version smaller than API 15. This doesn't cause a build issue in Gradle, and the lint warning is suppressed as it's ignored in API versions < 15. 如果您的目标版本小于API 15,则会发生android:textAllCaps问题。这不会在Gradle中引起构建问题,并且抑制了皮棉警告,因为在<15版本的API中它被忽略了。

I, too, downloaded the Facebook 4.0.0 SDK over the weekend and I had a lot of errors: 我也在周末下载了Facebook 4.0.0 SDK,但遇到了很多错误:

I did the following as we did when I installed 3.23.1: 1. Right click on the new Facebook project (the one you imported) and hilight the Android Tools , then select Add Support Library . 与安装3.23.1时一样,我做了以下操作:1.右键单击新的Facebook项目(您导入的项目),然后突出显示Android Tools ,然后选择添加支持库 2. Clean the project 2.清理项目

Here comes the key part: 3. It seems like 4.0.0 does not come w/ the bolts' jar file. 这里是关键部分:3.似乎4.0.0没有带有螺栓的jar文件。 You can import the bolts-1.1.2.jar as an external library from the older version of the Facebook SDK. 您可以从旧版Facebook SDK中将bolts-1.1.2.jar导入为外部库。 Let me know if you need detail on how to do that. 让我知道您是否需要有关操作方法的详细信息。 Hope this helps and good luck! 希望这会有所帮助,并祝你好运!

Follow it for the eclipse it's a best solution 跟随它的日食是最好的解决方案

  1. goto this url and dowload the zip of it gith hub 转到这个网址,然后下载它的ZIP GITH枢纽
  2. then extract the zip and open the folder facebook-android-sdk-master a libs folder is inside. 然后解压缩zip并打开文件夹facebook-android-sdk-master,其中有一个libs文件夹。 copy that folder and paste it to facebook sdk root 复制该文件夹并将其粘贴到Facebook SDK根目录

Now import that into eclipse and right click on it in eclipse and follow the next step 现在将其导入Eclipse中,然后在Eclipse中右键单击它,然后执行下一步

  1. Now select facebook sdk and change it's compile API to 4.4 or > 现在选择facebook sdk并将其编译API更改为4.4或>

  2. Now go to src>com.facebook> AccessToken inside it HashSet/ArrayList and cursor show you the suggestion to change it to jre 1.7 just do it. 现在转到HashSet / ArrayList里面的src> com.facebook> AccessToken,然后光标向您显示将其更改为jre 1.7的建议。

Success 成功

I faced the same problem with latest Facebook SDK 4.6.0 我在最新的Facebook SDK 4.6.0中遇到了同样的问题

I solve it following the next steps: 我按照以下步骤解决它:

  1. add to AndroidManifest.xml this code <uses-sdk android:minSdkVersion="15"/> or higher. 将此代码<uses-sdk android:minSdkVersion="15"/>或更高版本添加到AndroidManifest.xml
  2. From project > Properties > Android > choose Android 4.4.2 to solve problem of compilation with java 1.7 project > Properties > Android >选择Android 4.4.2以解决使用java 1.7进行编译的问题
  3. Create folder libs at your project folder then copy android-support-v4.jar from ../android-sdk-linux/extras/android/support/v4 to libs 在您的项目文件夹中创建文件夹libs ,然后将android-support-v4.jar../android-sdk-linux/extras/android/support/v4libs
  4. Download bolts.jar from that link : https://github.com/BoltsFramework/Bolts-Android 从该链接下载bolts.jar: https//github.com/BoltsFramework/Bolts-Android
  5. Copy bolts-android-ver.jar to libs bolts-android-ver.jar复制到libs
  6. Clean your project. 清理您的项目。

Enjoy ... I hope this is helpful for you 享受...希望对您有帮助

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

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