私のLoginActivity
には、ユーザがメールとパスワードを入力するためのEditText
が含まれています。すべてのコードは私にとっては問題ないようです。無効なメールでFirebaseユーザのログインに失敗しましたcom.google.firebase.authが見つかりません
ただし、ログインボタンをクリックした後、ユーザーはログインしません。これは、電子メールのEditText
には、以下のように含まれている、電子メールが無効であることが判明:
android.support.v7.widget.AppCompatEditText{b014ce3 VFED..CL. .F...... 56,646-1384,804 #7f0d0096 app:id/etEmailLogin}
間違っているものを見つけるために私を助けてください。メッセージ次
package com.example.loyalfine.myponda.app;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
public class LoginActivity extends AppCompatActivity {
private static final String TAG = "LoginActivity";
private FirebaseAuth.AuthStateListener mAuthListener;
private FirebaseAuth mAuth;
private EditText etEmailLogin;
private EditText etPasswordLogin;
private Button bLogin;
private Button bSwitchToRegister;
private Button bResetPassword;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
mAuth = FirebaseAuth.getInstance();
Toast.makeText(LoginActivity.this, (findViewById(R.id.etEmailLogin)).toString().trim(), Toast.LENGTH_LONG).show();
mAuthListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
// User is signed in
Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
Toast.makeText(LoginActivity.this, "onAuthStateChanged:signed_in:", Toast.LENGTH_LONG).show();
} else {
// User is signed out
Log.d(TAG, "onAuthStateChanged:signed_out");
Toast.makeText(LoginActivity.this, "onAuthStateChanged:signed_out:", Toast.LENGTH_LONG).show();
}
}
};
etEmailLogin = (EditText) findViewById(R.id.etEmailLogin);
etPasswordLogin = (EditText) findViewById(R.id.etPasswordLogin);
bLogin = (Button) findViewById(R.id.bLogin);
bLogin.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
signIn();
}
});
bSwitchToRegister = (Button) findViewById(R.id.bSwitchToRegister);
bSwitchToRegister.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent in = new Intent(LoginActivity.this, RegisterActivity.class);
startActivity(in);
}
});
bResetPassword = (Button) findViewById(R.id.bResetPassword);
bResetPassword.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//TODO: com.firebase.ui.auth.ui.email.ConfirmRecoverPasswordActivity
}
});
}
@Override
public void onStart() {
super.onStart();
mAuth.addAuthStateListener(mAuthListener);
}
@Override
public void onStop() {
super.onStop();
if (mAuthListener != null) {
mAuth.removeAuthStateListener(mAuthListener);
}
}
public void signIn() {
final String passwordl = etPasswordLogin.toString().trim();
final String emaill = etEmailLogin.toString().trim();
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
Toast.makeText(LoginActivity.this, user.getEmail()+"; "+ (findViewById(R.id.etEmailLogin)).toString().trim(), Toast.LENGTH_LONG).show();
Log.d(TAG, emaill);
mAuth.signInWithEmailAndPassword(emaill, passwordl);
Intent in = new Intent(LoginActivity.this, WelcomeActivity.class);
startActivity(in);
};
}
そして、私のLoginActivity
レイアウトが
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.loyalfine.myponda.app.LoginActivity"
android:orientation="vertical"
android:gravity="center_vertical">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Enter your Email"
android:id="@+id/etEmailLogin"
android:inputType="textEmailAddress" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/etPasswordLogin"
android:ems="10"
android:hint="Enter your password"
android:inputType="textPassword"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:id="@+id/bLogin"
android:layout_gravity="center_horizontal"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Not registered yet? Click here for redistration!"
android:id="@+id/bSwitchToRegister"
android:layout_gravity="center_horizontal"
android:clickable="true"
android:background="#0000"
android:textColor="#0a68ec"
android:textSize="12dp"
android:foreground="#0000" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Forget password? Click here to reset your password!"
android:id="@+id/bResetPassword"
android:layout_gravity="center_horizontal"
android:onClick="onClick"
android:textColor="#ed7a41"
android:textSize="10dp"
android:background="#0000" />
</LinearLayout>
です:
09-11 03:00:24.280 32751-32751/com.example.loyalfine.myponda.app W/ViewRootImpl[WelcomeActivity]: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=205.09277, y[0]=2066.7188, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=20468343, downTime=20463897, deviceId=0, source=0x1002 }
09-11 03:00:24.521 32751-32751/com.example.loyalfine.myponda.app D/LoginActivity: android.support.v7.widget.AppCompatEditText{b014ce3 VFED..CL. .F...... 56,646-1384,804 #7f0d0096 app:id/etEmailLogin}
09-11 03:00:24.567 32751-398/com.example.loyalfine.myponda.app W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
どちらも2トーストのように同じ内容を示しています
android.support.v7.widget.AppCompatEditText{b014ce3 VFED..CL. .F...... 56,646-1384,804 #7f0d0096 app:id/etEmailLogin}
また、私を聞かせてください理由を知っているこれは表示されます:
Local module descriptor class for com.google.firebase.auth not found.
あなたの優しさに感謝します。
UPDATES:、メッセージをgetText()
S、およびonCompleteListener
を追加した後 を示しています
09-11 07:36:28.969 30405-30405/com.example.loyalfine.myponda.app W/ViewRootImpl[LoginActivity]: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=157.06055, y[0]=2073.6719, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=37033032, downTime=36201038, deviceId=0, source=0x1002 }
09-11 07:36:28.969 30405-30405/com.example.loyalfine.myponda.app W/ViewRootImpl[LoginActivity]: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=157.06055, y[0]=2073.6719, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=37033032, downTime=36201038, deviceId=0, source=0x1002 }
09-11 07:36:28.969 30405-30405/com.example.loyalfine.myponda.app W/ViewRootImpl[LoginActivity]: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=157.06055, y[0]=2073.6719, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=37033032, downTime=36201038, deviceId=0, source=0x1002 }
09-11 07:36:28.969 30405-30405/com.example.loyalfine.myponda.app W/ViewRootImpl[LoginActivity]: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=157.06055, y[0]=2073.6719, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=37033032, downTime=36201038, deviceId=0, source=0x1002 }
09-11 07:36:31.559 30405-30416/com.example.loyalfine.myponda.app I/art: Background sticky concurrent mark sweep GC freed 12136(1617KB) AllocSpace objects, 54(1220KB) LOS objects, 24% free, 9MB/12MB, paused 6.324ms total 111.816ms
09-11 07:36:31.770 30405-30405/com.example.loyalfine.myponda.app D/***LoginActivity: onAuthStateChanged:signed_in:8cG1dBsCFlNDAWiQHXAN4NSaulN2***
09-11 07:36:36.797 30405-30405/com.example.loyalfine.myponda.app W/ViewRootImpl[WelcomeActivity]: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=153.06152, y[0]=2073.6719, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=37040855, downTime=37035146, deviceId=0, source=0x1002 }
09-11 07:36:36.797 30405-30405/com.example.loyalfine.myponda.app W/ViewRootImpl[WelcomeActivity]: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=153.06152, y[0]=2073.6719, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=37040855, downTime=37035146, deviceId=0, source=0x1002 }
09-11 07:36:36.797 30405-30405/com.example.loyalfine.myponda.app W/ViewRootImpl[WelcomeActivity]: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=153.06152, y[0]=2073.6719, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=37040855, downTime=37035146, deviceId=0, source=0x1002 }
09-11 07:36:36.797 30405-30405/com.example.loyalfine.myponda.app W/ViewRootImpl[WelcomeActivity]: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=153.06152, y[0]=2073.6719, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=37040855, downTime=37035146, deviceId=0, source=0x1002 }
09-11 07:36:42.688 30405-30405/com.example.loyalfine.myponda.app W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
09-11 07:36:45.336 30405-30405/com.example.loyalfine.myponda.app W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
09-11 07:36:45.966 30405-30405/com.example.loyalfine.myponda.app D/LoginActivity: ***android.support.v7.widget.AppCompatEditText{2ad64b4 VFED..CL. ........ 56,646-1384,804 #7f0d0096 app:id/etEmailLogin}***
09-11 07:36:45.983 30405-30444/com.example.loyalfine.myponda.app W/DynamiteModule: Local module descriptor class for ***com.google.firebase.auth not found.***
09-11 07:36:45.983 30405-30444/com.example.loyalfine.myponda.app W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
09-11 07:36:56.234 30405-30444/com.example.loyalfine.myponda.app W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
補完リスナーを 'signInWithEmailAndPassword()'に追加して、サインインが失敗した理由を確認してください。 [このサンプルコード](https://github.com/firebase/quickstart-android/blob/master/auth/app/src/main/java/com/google/firebase/quickstart/auth/EmailPasswordActivity.java#L150)を使用します。 -L172)をクイックスタートプロジェクトから削除します。 –
はい、完了リスナーをsignInWithEmailAndPassword()に追加しました。結果は同じでした。そして、問題はonCreateメソッドが起動した直後に発生しているようです.... –
このステートメントでログに記録されたエラー例外は何ですか: 'Log.w(TAG、" signInWithEmail:failed "、task.getException())'? –