使用firebase-ui-auth执行时出错

时间:2018-05-09 19:43:52

标签: firebase authentication firebase-authentication

我有这个错误:

java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.CharSequence
android.view.inputmethod.InputConnection.getTextAfterCursor(int, int)' on a null object reference at android.view.inputmethod.InputConnectionWrapper.getTextAfterCursor(InputConnectionWrapper.java:86)
at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:246)
at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:85)

at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

这是代码......:

公共类MainActivity扩展了AppCompatActivity {

private FirebaseAuth firebaseAuth;
private FirebaseAuth.AuthStateListener authStateListener;
private static final int RC_SIGN_IN = 123;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    firebaseAuth = FirebaseAuth.getInstance();
    authStateListener = new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            FirebaseUser fbUser = firebaseAuth.getCurrentUser();
            if (fbUser != null){

            } else {
                startActivityForResult(
                        AuthUI.getInstance()
                                .createSignInIntentBuilder()
                                .setIsSmartLockEnabled(false)
                                .setAvailableProviders(Arrays.asList(
                                        new AuthUI.IdpConfig.EmailBuilder().build(),
                                        new AuthUI.IdpConfig.GoogleBuilder().build()))
                                .build(),
                        RC_SIGN_IN);
            }
        }
    };
}

知道什么是错的吗?

谢谢!

0 个答案:

没有答案