0

I´m implementing a android login button, when I start the app I get the following message error.

E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.droidsmile.opinions, PID: 31695 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.droidsmile.opinions/com.droidsmile.opinions.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class com.facebook.login.widget.LoginButton

And other line:

Caused by: The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.

Where can I call the method?

Thanks.

Sam FarajpourGhamari
  • 14,601
  • 4
  • 52
  • 56
povelio
  • 3
  • 3

1 Answers1

2

You have to use FacebookSdk.sdkInitialize(getApplicationContext()); before setContentView(R.layout.your_activity_layout); as documentation states out. In case you need a complete facebook login example, check this one here.
check this answer.

Community
  • 1
  • 1
Bisho Adam
  • 191
  • 1
  • 2
  • 12