5

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?

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

Abhishek V
  • 12,488
  • 6
  • 51
  • 63
  • 1
    I was under the impression that only the parts of the SDK that you are actually using will be compiled into the resulting binary to begin with …? – CBroe Dec 10 '15 at 12:25
  • 1
    @CBroe All the parts of SDK will be compiled into binary unless we use proguard. But even proguard isn't making much of a difference for some reason. It would be great if facebook itself can provide the SDK in smaller modules instead of relying on progurad :) – Abhishek V Dec 10 '15 at 18:23

1 Answers1

1

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' } }

Community
  • 1
  • 1
piotrek1543
  • 19,130
  • 7
  • 81
  • 94
  • Thanks for the answer. 1. We cannot use any third party alternatives for login due to security concerns. 2) Not an option. There is a requirement to keep all the SDKs updated 3) Better of the three options. We will look into it. But I don't think the modules are clearly separated, so removing one module might affect the other. – Abhishek V Dec 10 '15 at 18:27
  • 1
    Requirement, really? Ok. Maybe it's time to start a bounty for this issue. Nowadays I don't see any other solution – piotrek1543 Dec 10 '15 at 18:48
  • Yes. We believe that keeping the SDKs updated will prevent the app from unexpected failures due to deprecated APIs. Newer versions of SDKs not only contain new functionalities, there will be other internal changes/enhancements as well. For ex, older versions of facebook sdk uses graph API 1.0 which has been deprecated now. Will wait for few more days before I start bounty :) – Abhishek V Dec 10 '15 at 19:17