[英]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所需的功能吗?
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. 在google play services
情况下,Google Repository中添加了包含单个功能域的其他maven工件。这意味着我们可以仅包含您的应用使用的Google Play服务部分。
dependencies { compile 'com.google.android.gms:play-services-ads:6.5.+' } ( http://googleadsdeveloper.blogspot.in/2015/01/reducing-google-play-services-impact-on.html ) 依赖项{compile'com.google.android.gms:play-services-ads:6.5。+'}( http://googleadsdeveloper.blogspot.in/2015/01/reducing-google-play-services-impact-on。 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. 甚至twitter也将它的面料SDK分成了更小的模块(Core,Crashlytics,Digits,tweetUI等),这对缩小apk的大小非常有帮助。 ( https://docs.fabric.io/android/index.html ) ( https://docs.fabric.io/android/index.html )
Is similar feature available for facebook SDK as well? Facebook SDK也有类似的功能吗? Any help is appreciated. 任何帮助表示赞赏。 Thanks! 谢谢!
I see some possible ways : 我看到一些可能的方法:
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因此,尽量找到最适合您需求的库
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身份验证
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.