简体   繁体   English

减小android facebook SDK的大小

[英]Reduce the size of android facebook SDK

We are using facebook sdk to login the users to our app. 我们正在使用facebook sdk将用户登录到我们的应用程序。 But the SDK is pretty large hence it is increasing our apk size. 但SDK非常大,因此它增加了我们的apk大小。 Since we use only the login feature we do not require other modules of SDK (share, messenger etc). 由于我们只使用登录功能,因此我们不需要SDK的其他模块(共享,信使等)。 Is there any way we can add only the required features of SDK in the project? 有什么办法可以在项目中只添加SDK所需的功能吗?

Is similar feature available for facebook SDK as well? Facebook SDK也有类似的功能吗? Any help is appreciated. 任何帮助表示赞赏。 Thanks! 谢谢!

I see some possible ways : 我看到一些可能的方法:

  1. There are some Facebook sdk alternatives on GitHub like: https://github.com/greenhalolabs/facebooklogin https://github.com/sromku/android-simple-facebook So try to find the best fitted library for your needs 在GitHub上有一些Facebook sdk替代品,如: https//github.com/greenhalolabs/facebooklogin https://github.com/sromku/android-simple-facebook因此,尽量找到最适合您需求的库

  2. You can try to use older Facebook library, which would be lighter, but also lack of some functions. 您可以尝试使用较旧的Facebook库,这将更轻,但也缺乏一些功能。

Before you do this point read some articles like this: Facebook authentication without login button 在此之前,请阅读以下文章: 没有登录按钮的Facebook身份验证

  1. Finally, try to exclude unnecessary libs like in this example: 最后,尝试排除不必要的lib,如下例所示:

    dependencies {compile('com.facebook.android:facebook-android-sdk:4.3.0') { exclude module: 'support-v4' } } dependencies {compile('com.facebook.android:facebook-android-sdk:4.3.0'){exclude module:'support-v4'}}

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

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