Android 在安卓系统中使用firebase登录facebook时出现充气异常
我想在我的android应用程序中使用firebase登录facebook,因此在将我的应用程序与firebase连接后,我添加了facebook sdk的依赖项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
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。它更简单、更直接