Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reduce the size of android facebook 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?

  • 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.

    dependencies { 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. (https://docs.fabric.io/android/index.html)

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

like image 915
Abhishek V Avatar asked Nov 09 '22 00:11

Abhishek V


1 Answers

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

  2. You can try to use older Facebook library, which would be lighter, but also lack of some functions.

Before you do this point read some articles like this: Facebook authentication without login button

  1. Finally, try to exclude unnecessary libs like in this example:

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

like image 141
piotrek1543 Avatar answered Nov 14 '22 21:11

piotrek1543