减小android facebook SDK的大小 [英] Reduce the size of android facebook SDK

查看:181
本文介绍了减小android facebook SDK的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用 facebook sdk 将用户登录到我们的应用程序。但SDK非常大,因此增加了我们的apk大小。由于我们仅使用登录功能,因此我们不需要SDK(共享,信使等)的其他模块。有什么办法可以在项目中添加SDK的必需功能?

We are using facebook sdk to login the users to our app. But the SDK is pretty large hence it is increasing our apk size. Since we use only the login feature we do not require other modules of SDK (share, messenger etc). Is there any way we can add only the required features of SDK in the project?


  • 如果 Google Play服务,已将额外的maven工件添加到包含单一功能域的Google Repository中。这意味着我们可以仅包含您的应用使用的Google Play服务部分。

  • In case of google play services, additional maven artifacts have been added to the Google Repository that contain single domains of functionality.This means that we can include just those portions of Google Play services that your app uses.

依赖关系{
compile'c​​om.google.android.gms:play-services-ads:6.5。+'
}
http://googleadsdeveloper.blogspot.in/2015/01 /reducing-google-play-services-impact-on.html

即使twitter已将其面料SDK分解成较小的模块(Core, Crashlytics,Digits,tweetUI等),这对减少apk的大小非常有帮助。
https://docs.fabric.io/android/index.html

Even twitter has split it's fabric SDK into smaller modules(Core, Crashlytics, Digits, tweetUI etc) which is really helpful in reducing the size of apk. (https://docs.fabric.io/android/index.html)

与Facebook SDK相似的功能?任何帮助是赞赏。谢谢!

Is similar feature available for facebook SDK as well? Any help is appreciated. Thanks!

推荐答案

我看到一些可能的方法:

I see some possible ways :


  1. GitHub上有一些Facebook sdk替代品,如:
    https:// github.com/greenhalolabs/facebooklogin
    https://github.com / sromku / android-simple-facebook
    所以尽量找到最适合您的需要的图书馆

  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

你可以尝试使用较旧的Facebook图书馆,这将更轻,但也缺乏一些功能。

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


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

依赖关系{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' } }

这篇关于减小android facebook SDK的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆