[英]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.