The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first
<p>I have this error when implementing the Facebook SDK and i <a href="https://stackoverflow.com/questions/15490399/error-inflating-class-com-facebook-widget-loginbutton">tried</a> - <a href="https://stackoverflow.com/a/29739958/1874460">many of the</a> - <a href="https://stackoverflow.com/a/33733713/1874460">solutions</a> but none of then worked. This is what i have:</p>

<pre><code>@Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        FacebookSdk.sdkInitialize(getApplicationContext());
        callbackManager = CallbackManager.Factory.create();
        setContentView(R.layout.activity_name_layout);

LoginButton loginButton = (LoginButton)findViewById(R.id.fb_login_button);
        loginButton.setReadPermissions(Arrays.asList("public_profile", "email"));
        loginButton.registerCallback(callbackManager, new FacebookCallback&lt;LoginResult&gt;() {
            @Override
            public void onSuccess(LoginResult loginResult) {

            }

            @Override
            public void onCancel() {

            }

            @Override
            public void onError(FacebookException error) {

            }
        });

     @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            callbackManager.onActivityResult(requestCode, resultCode, data);
        }
</code></pre>

<p>Graddle:</p>

<pre><code>compile 'com.facebook.android:facebook-android-sdk:4.8.0'
</code></pre>

<p>Manifest:</p>

<pre><code> &lt;activity android:name="com.facebook.FacebookActivity"
            android:configChanges=
                "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:label="@string/app_name" /&gt;
</code></pre>

<p>Layout button:</p>

<pre><code>&lt;LinearLayout

    xmlns:facebook="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:background="@color/colorPrimaryDark"
    android:padding="10dp"
    android:layout_height="match_parent"&gt;

  &lt;com.facebook.login.widget.LoginButton
        android:layout_marginTop="10dp"
        android:id="@+id/fb_login_button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        &gt;&lt;/com.facebook.login.widget.LoginButton&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>Can someone point me out what im doing wrong?</p>