0

Hi to all i'm trying to add the facebook login avaible in the facebook sdk (i'm using the 4.16.0 ver) but i got this error

android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.facebook.login.widget.LoginButton

Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.facebook.login.widget.LoginButton

i'm already read here but it did not work for me i post here my build.gradle file

Thank's to all!

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/layoutLogin"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/cardview_light_background"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/imageView4"
        android:layout_width="match_parent"
        android:layout_height="456dp"
        android:contentDescription="imm"
        android:src="@drawable/lloyd_thumbs" />

    <Space
        android:layout_width="match_parent"
        android:layout_height="25dp" />

    <Button
        android:id="@+id/log_or_reg"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/cardview_shadow_end_color"
        android:text="Loggati e/o Registrati" />

    <com.facebook.login.widget.LoginButton
        android:id="@+id/login_button"
        android:layout_width="344dp"
        android:layout_height="54dp"
        android:layout_gravity="center_horizontal"
        android:layout_marginBottom="30dp"
        android:layout_marginTop="30dp" />

</LinearLayout>

edit: the problem is only when I try to inflate the activity, if I use intent I don't have any problem

Trusted
  • 225
  • 1
  • 4
  • 14

2 Answers2

2

This is probably because you haven't initialised the Facebook SDK. Initiate that in the application class as below.

public class AppController extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        FacebookSdk.sdkInitialize(this);    
    }
}
0

If you have the same problem, try this.

in your buil.gradle file add this

compile 'com.android.support:multidex:1.0.0'

and add in default config this

default config{
     //other stuff
     multiDexEnabled true
     //other stuff
}

and in yuor application add this MultiDex.install(this);

Thank's myself for answer!

Trusted
  • 225
  • 1
  • 4
  • 14