简体   繁体   English

在Android Studio中运行Facebook SDK示例应用

[英]Run Facebook SDK sample apps in Android Studio

Novice question. 新手问题。

What is the recommended way to run the sample apps, included in the Facebook SDK, in Android Studio (0.8.6)? 建议在Android Studio(0.8.6)中运行Facebook SDK中包含的示例应用程序的推荐方式是什么?

The ideal answer would include step-by-step instructions. 理想的答案将包括分步说明。

I'm using Android Studio version 0.8.0, and Facebook SDK 3.18. 我正在使用Android Studio 0.8.0版和Facebook SDK 3.18。

When I tried to open a sample as a separate project, it can't find Gradle and wasn't able to run it. 当我尝试将一个示例作为一个单独的项目打开时,它找不到Gradle并且无法运行它。 However, when I imported /samples folder as a root, all sample projects were imported and was able to run each samples. 但是,当我将/ samples文件夹作为根导入时,所有示例项目均已导入,并且能够运行每个示例。

File > Import Project > Select FACEBOOK_SDK_PATH/samples > OK > Create project from existing sources

and then, click next/ok as Android Studio's default setting. 然后,单击“下一步” /“确定”作为Android Studio的默认设置。

Hope it helps! 希望能帮助到你!

Suposing you already downloaded and unzipped the SDK. 假设您已经下载并解压缩了SDK。

  1. Create your android project. 创建您的android项目。 Gradle based. 基于Gradle。

  2. File -> Import Module. 文件->导入模块。 Navigate to the unzipped folder and select the unzipped folder. 导航到解压缩的文件夹,然后选择解压缩的文件夹。

  3. Add the library dependency in your main module (the one created with your project) adding this line in your build.gradle: 在主模块(使用项目创建的模块)中添加库依赖项,并在build.gradle中添加以下行:

  4. Synchonize project. 同步项目。

If you want to continue creating your own app, you might add the dependency module build.gradle file: 如果要继续创建自己的应用程序,则可以添加依赖项模块build.gradle文件:

android {
    dependencies {
        compile project (':facebook')
    }
}

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

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