我正在尝试使用教程在 android studio 中创建一个聊天应用程序:https : //code.tutsplus.com/tutorials/how-to-create-an-android-chat-app-using-firebase--cms-27397
据我所知,我完全按照他说的做了,但是在我输入电子邮件后,我的应用程序崩溃了。
我检查了 logcat,但找不到任何有用的东西。
主活动.java
public class MainActivity extends AppCompatActivity {
private static final int SIGN_IN_REQUEST_CODE = 111;
private FirebaseListAdapter<ChatMessage> adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(FirebaseAuth.getInstance().getCurrentUser() == null) {
// Start sign in/sign up activity
startActivityForResult(AuthUI.getInstance().createSignInIntentBuilder().build(), SIGN_IN_REQUEST_CODE);
} else {
// User is already signed in. Therefore, display
// a welcome Toast
Toast.makeText(this, "Welcome " + FirebaseAuth.getInstance().getCurrentUser().getDisplayName(), Toast.LENGTH_LONG).show();
// Load chat room contents
displayChatMessages();
}
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new …Run Code Online (Sandbox Code Playgroud)