简体   繁体   English

我可以在Facebook SDK 3.23.1中使用“ import com.facebook.FacebookSdk;”吗?

[英]Can I use “import com.facebook.FacebookSdk;” with Facebook SDK 3.23.1?

In my app\\build.gradle file, I have compile 'com.facebook.android:facebook-android-sdk:3.23.1' . 在我的app \\ build.gradle文件中,我compile 'com.facebook.android:facebook-android-sdk:3.23.1' In my BaseActivity.java file (where I have "public class BaseActivity extends Activity"), I am trying to use this: import com.facebook.FacebookSdk; 在我的BaseActivity.java文件(其中有“公共类BaseActivity扩展Activity”)中,我试图使用此代码: import com.facebook.FacebookSdk; . This is the error I get: 这是我得到的错误:

Error:(8, 20) error: cannot find symbol class FacebookSdk
Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details.

I am using https://developers.facebook.com/quickstarts/ to follow the instructions for adding Facebook SDK to a project. 我正在使用https://developers.facebook.com/quickstarts/按照说明将Facebook SDK添加到项目中。 One of the steps is: "Import Facebook SDK into your app", and they provide the following line: 步骤之一是:“将Facebook SDK导入到您的应用程序中”,并且它们提供以下行:

import com.facebook.FacebookSdk;

Is it possible to do this with Facebook SDK 3.23.1? Facebook SDK 3.23.1是否可以执行此操作? I wonder if the instructions imply the use of Facebook SDK 4.0.0 or higher. 我想知道指令是否暗示使用Facebook SDK 4.0.0或更高版本。

UPDATE: I am copying my dependencies below. 更新:我在下面复制我的依赖项。

dependencies {
compile 'com.google.code.gson:gson:2.2.4'
compile files('libs/AndroidSDK-2.15.9.jar')
compile files('libs/core.jar')
compile files('libs/easyfacebookandroidsdk_2.3.jar')
compile files('libs/PayPal_MPL.jar')
compile files('libs/signpost-commonshttp4-1.2.1.1.jar')
compile files('libs/signpost-core-1.2.1.1.jar')
compile files('libs/socialauth-4.2.jar')
compile files('libs/twitter4j-core-3.0.5.jar')
compile files('libs/urbanairship-lib-3.3.0.jar')
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.facebook.android:facebook-android-sdk:3.23.1'}

No, “import com.facebook.FacebookSdk;” is only available from Facebook SDK 4.0.0. 不可以,“ import com.facebook.FacebookSdk;”仅可从Facebook SDK 4.0.0获得。 Yes, it is possible to use Facebook Analytics with Facebook SDK v3.x. 是的,可以将Facebook Analytics(分析)与Facebook SDK v3.x一起使用。 I finally have Facebook Analytics working using Facebook SDK v3.23.1. 我终于有了使用Facebook SDK v3.23.1的Facebook Analytics。 I used the AppEventsLogger class as explained at https://developers.facebook.com/docs/reference/android/3.23.1/class/AppEventsLogger/ . 我使用了https://developers.facebook.com/docs/reference/android/3.23.1/class/AppEventsLogger/中所述的AppEventsLogger类。

Use the latest version of facebook SDK. 使用最新版本的facebook SDK。 I've integrated it recently and it's working fine. 我最近对其进行了集成,并且运行良好。

dependencies{

compile 'com.facebook.android:facebook-android-sdk:4.+'

}

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

相关问题 Facebook SDK 3.23.1是否包括FBNotifications库? - Does Facebook SDK 3.23.1 include the FBNotifications library? Facebook SDK版本3.23.1支持Facebook推送通知功能吗? - Is the Facebook Push Notifications feature supported by Facebook SDK version 3.23.1? 如果我使用FB SDK移动版并且用户授予权限,是否可以加载facebook.com? - If I use the FB SDK for mobile and a user gives permissions, can I load facebook.com? 用于SDK v3.23.1的Facebook SDK初始化以实现Android的应用程序事件 - Facebook SDK Initialization for SDK v3.23.1 to implement App Events for Android 为什么我不能正确导入facebook SDK? - Why can't I import the facebook SDK correctly? 如何将我的android SDK的标准片段与facebook SDK一起使用? - how can I use the standard Fragment of the android SDK with facebook SDK? 无法导入facebook-sdk 4.0.1 - Can not import facebook-sdk 4.0.1 Facebook android sdk 无法导入到 eclipse 中的工作区 - Facebook android sdk can not import into workspace in eclipse Facebook SDK,Android依赖项显示facebooksdk.jar丢失 - Facebook sdk, Android dependencies showing facebooksdk.jar is missing Facebook Sdk 尚未初始化 FacebookSdk.sdkInitialize() - Facebook Sdk Has Not Been Initialized FacebookSdk.sdkInitialize()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM