简体   繁体   English

在Android项目中启用Facebook SDK

[英]Enabling Facebook SDK in an Android Project

I specify the Facebook SDK as a remote dependency in my build.gradle file, however I've also had to import the actual SDK files into my Android project. 我在build.gradle文件中将Facebook SDK指定为远程依赖项,但是我还必须将实际的SDK文件导入到我的Android项目中。 Isn't that redundant? 那不是多余的吗? Or does the specification of the remote dependency and the import of the Facebook SDK files fulfill two different requirements. 或者,远程依赖关系的规范和Facebook SDK文件的导入是否满足两个不同的要求。

If I want to update the SDK version my app uses, is it necessary to update the actual SDK files I previously imported into my project? 如果我想更新我的应用程序使用的SDK版本,是否需要更新以前导入到项目中的实际SDK文件? Or can I just update my dependency in the build.gradle file? 还是可以仅在build.gradle文件中更新我的依赖项?

Open your your_app | 打开your_app | build.gradle, and add the compile dependency build.gradle,并添加编译依赖项

dependencies { 
  compile 'com.facebook.android:facebook-android-sdk:4.+'
}

Build your project. 建立您的专案。 Now you can import com.facebook.FacebookSdk into your app. 现在,您可以将com.facebook.FacebookSdk导入您的应用程序。

It's all what you need to use de Facebook Sdk. 这是使用de Facebook Sdk所需的全部。 If you want to update facebook sdk version just change de compile dependency and sync gradle. 如果您想更新facebook sdk版本,只需更改de compile依赖性并同步gradle。

For more information visit Facebook Docs 有关更多信息,请访问Facebook Docs。

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

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