Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/203.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在安卓系统中使用firebase登录facebook时出现充气异常_Android_Facebook_Firebase_Firebase Authentication_Inflate Exception - Fatal编程技术网

Android 在安卓系统中使用firebase登录facebook时出现充气异常

Android 在安卓系统中使用firebase登录facebook时出现充气异常,android,facebook,firebase,firebase-authentication,inflate-exception,Android,Facebook,Firebase,Firebase Authentication,Inflate Exception,我想在我的android应用程序中使用firebase登录facebook,因此在将我的应用程序与firebase连接后,我添加了facebook sdk的依赖项compile'com.facebook.android:facebook android sdk:[4,5],但当我运行我的应用程序时,它会显示出来 android.view.InflateException:二进制XML文件行#20:二进制XML文件行#20:膨胀类com.facebook.login.widget.LoginBut

我想在我的android应用程序中使用firebase登录facebook,因此在将我的应用程序与firebase连接后,我添加了facebook sdk的依赖项
compile'com.facebook.android:facebook android sdk:[4,5]
,但当我运行我的应用程序时,它会显示出来

android.view.InflateException:二进制XML文件行#20:二进制XML文件行#20:膨胀类com.facebook.login.widget.LoginButton时出错

XML代码

<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.environer.becofriend.MainActivity"
android:orientation="vertical"
android:gravity="center">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hello World!"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<com.facebook.login.widget.LoginButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

</LinearLayout>
compile 'com.facebook.android:facebook-android-sdk:4.0.0'


注意:我没有在MainActivity中添加任何代码,因为sdk是在新sdk中自动初始化的

试试这个,我想更改等级就可以了,我有工作示例

1) Gradle

<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.environer.becofriend.MainActivity"
android:orientation="vertical"
android:gravity="center">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hello World!"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<com.facebook.login.widget.LoginButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

</LinearLayout>
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
2) XML

<com.facebook.login.widget.LoginButton
                    android:background="@drawable/login_button_back_one"
                    android:id="@+id/login_button"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"/>

试试这个,我想改变成绩就行了,我有工作的例子

1) Gradle

<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.environer.becofriend.MainActivity"
android:orientation="vertical"
android:gravity="center">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hello World!"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<com.facebook.login.widget.LoginButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

</LinearLayout>
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
2) XML

<com.facebook.login.widget.LoginButton
                    android:background="@drawable/login_button_back_one"
                    android:id="@+id/login_button"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"/>

我想使用最新的facebook sdk,因为以前的版本有一些错误。试试我的示例,如果它有效,那么只需更改SDKI的版本。我想使用最新的facebook sdk,因为以前的版本有一些错误。试试我的示例,如果它有效,那么只需更改SDKUse FirebaseUI auth的版本。它是更简单、更直接使用FirebaseUI auth。它更简单、更直接