Я следую инструкциям по внедрению аутентификации Google в моем приложении Android. Я достиг стадии, когда я добавляю предопределенную кнопку google в свой файл activity_login. xml файл, как это объяснено здесь :
<com.google.android.gms.common.SignInButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="Login"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="50dp"/>
Однако в окне предварительного просмотра ничего не отображается, кроме строка где кнопка должна быть:
Вот скриншот из Учебного пособия, чтобы объяснить, как он должен Появитесь:
Я внимательно следил за каждым шагом, как объяснено в учебном пособии, поэтому я действительно не понимаю, почему это не работает.
В основном, у меня есть добавил их в app / build.gradle в зависимости:
implementation 'com.google.firebase:firebase-analytics:17.2.0' //Added for google authentication
implementation 'com.google.firebase:firebase-auth:19.2.0' //Added for google authentication
implementation 'com.google.android.gms:play-services-auth:17.0.0' //Added for google authentication
И я добавил это в project / build.gradle в зависимости:
classpath 'com.google.gms:google-services:4.3.2' // Added for authentication
Любая идея, почему кнопка не появляется ??
РЕДАКТИРОВАТЬ 1 : Как требуется, вот весь код XML:
PS: Обычно появляется обычная кнопка.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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=".Activity.LoginActivity">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/image_bg_login">
</ImageView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:textAlignment="center"
android:textColor="#000"
android:textSize="26sp"
android:text="Things End. \n But memories last forever. \n Share your memories \n With the world"
android:textStyle="bold|italic">
</TextView>
</RelativeLayout>
<com.google.android.gms.common.SignInButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="Login"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="50dp"/>
</FrameLayout>
</RelativeLayout>