FacebookSdk.sdkInitialize(getApplicationContext()) Deprecated

I’m integrating facebook SDK in my app as an option to login for the users. But recently I have started getting FacebookSdk.sdkInitialize(getApplicationContext()) as Deprecated

   @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        FacebookSdk.sdkInitialize(getApplicationContext());
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolBar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);

So after hustling for long I was able to find the solution to this.

  • How to create spinner with heading in it?
  • How do I use databinding to combine a string from resources with a dynamic variable in XML?
  • selectableItemBackground as item in layer-list
  • Appcompat CardView and Picasso no rounded Corners
  • Android Retrofit2 Refresh Oauth 2 Token
  • Spinner onItemSelected called erroneously (without user action)
  • Related posts:

    Where is android studio building my .apk file?
    Widget that calls speech recognition app
    Web view with No suitable EGL configs found error
    Set notification to specific time
    Failed to load the LayoutLib: com.android.layoutlib.bridge.Bridge
    Issues in publishing unsigned .apk file?
  • Google sign-in Android with Firebase - statusCode DEVELOPER_ERROR
  • Android Palette: Why not working with this particular image?
  • Multiple Shared Elements
  • Android - Unable to instantiate activity - Class not found exception after upgrading to ADT 22
  • Android: What is the share dialog class in Facebook SDK 4.x
  • How can I set up Vim for Android development?
  • 2 Solutions collect form web for “FacebookSdk.sdkInitialize(getApplicationContext()) Deprecated”

    So according to the latest facebook documentation we now don’t need to initialize the facebook SDK and it automatically gets invoked. So now FacebookSdk.sdkInitialize(getApplicationContext()) can be deleted.

    Simply do not write this line of code in your class

    FacebookSdk.sdkInitialize(getApplicationContext());
    
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.