这是我在signup.java上的代码,它只是一个制作注册表单的做法 . 这是一个注册,只询问电子邮件和密码,但当我尝试打开我的应用程序时,它突然停止 . 我不知道为什么 .

package com.secretfiles.www.secretfiles;

    import android.app.ProgressDialog;
    import android.support.annotation.NonNull;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.text.TextUtils;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.ProgressBar;
    import android.widget.TextView;
    import android.widget.Toast;

    import com.google.android.gms.tasks.OnCompleteListener;
    import com.google.android.gms.tasks.Task;
    import com.google.firebase.auth.AuthResult;
    import com.google.firebase.auth.FirebaseAuth;

public class SignUp extends AppCompatActivity implements View.OnClickListener {
    private Button btnSignUp;
    private EditText etxtemail;
    private EditText etxtpword;
    private TextView txtview;

    private ProgressDialog progressDialog;

    private FirebaseAuth firebaseAuth;

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

        firebaseAuth = FirebaseAuth.getInstance();

        progressDialog = new ProgressDialog(this);

        btnSignUp = (Button) findViewById(R.id.btnSignUp);
        etxtemail = (EditText) findViewById(R.id.etxtemail);
        etxtpword = (EditText) findViewById(R.id.etxtpword);
        txtview = (TextView) findViewById(R.id.txtview);

        btnSignUp.setOnClickListener(this);
        txtview.setOnClickListener(this);
    }

    private void registerUser(){
        String email = etxtemail.getText().toString().trim();
        String pword = etxtpword.getText().toString().trim();

        if(TextUtils.isEmpty(email)){
            //uname is empty
            Toast.makeText(this, "Please enter username", Toast.LENGTH_SHORT).show();
            //stopping the function execution further
            return;
        }
        if(TextUtils.isEmpty(pword)){
            //pword is empty
            Toast.makeText(this, "Please enter password", Toast.LENGTH_SHORT).show();
            //stopping the function
            return;
        }

        //if validations are ok
        //we will show a progressbar
        progressDialog.setMessage("Resgistering User...");
        progressDialog.show();

        firebaseAuth.createUserWithEmailAndPassword(email, pword)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if(task.isSuccessful()){
                        //user is successfully resgistered and logged in
                        //we will start the progile activity here
                        //right now lets display a toast only
                        Toast.makeText(SignUp.this, "Regisrered Successfully", Toast.LENGTH_SHORT).show();
                    }else {
                        Toast.makeText(SignUp.this, "Could not register... Please try again", Toast.LENGTH_SHORT).show();
                    }
                }
            });
    }
    @Override
    public void onClick(View view) {
        if (view == btnSignUp){
            registerUser();
        }

        if(view == txtview){
            //will open log in form
        }
    }
}

enter image description here

我认为它在我的应用程序目录中有我的gradle有一些东西我从youtube的教程中获得了这段代码https://www.youtube.com/watch?v=0NFwF7L-YA8

这是我在app目录中的成绩代码:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"`enter code here`
    defaultConfig {
        applicationId "com.secretfiles.www.secretfiles"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
    compile 'com.google.firebase:firebase-database:9.2.1'
    compile 'com.google.gms:google-services:3.0.0'
    compile 'com.google.firebase:firebase-auth:10.0.0'
    testCompile 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'

这是logcat:

01-22 16:17:12.527 2467-2477/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/metrics.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
01-22 16:17:12.528 2467-2477/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/help_responses.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
01-22 16:17:12.528 2467-2477/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/auto_complete_suggestions.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
01-22 17:23:52.154 2467-2477/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/metrics.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
01-22 17:23:52.445 2467-2477/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/help_responses.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
01-22 17:23:52.446 2467-2477/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/auto_complete_suggestions.db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
01-22 17:24:58.591 2500-2500/com.android.chrome W/IInputConnectionWrapper: getSelectedText on inactive InputConnection
01-22 17:24:58.650 2500-2500/com.android.chrome W/IInputConnectionWrapper: requestCursorAnchorInfo on inactive InputConnection
01-22 17:24:58.718 2500-2500/com.android.chrome W/IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
01-22 17:24:58.718 1609-1609/com.android.inputmethod.latin E/RichInputConnection: Unable to connect to the editor to retrieve text.
01-22 17:24:58.718 1609-1609/com.android.inputmethod.latin D/RichInputConnection: Will try to retrieve text later.
01-22 17:24:58.750 2500-2500/com.android.chrome W/IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
01-22 17:24:58.752 1609-1609/com.android.inputmethod.latin E/RichInputConnection: Unable to connect to the editor to retrieve text.
01-22 17:24:58.752 1609-1609/com.android.inputmethod.latin W/RichInputConnection: Unable to connect to the editor. Setting caps mode without knowing text.
01-22 17:24:58.767 2500-2500/com.android.chrome W/IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
01-22 17:24:58.768 1609-1609/com.android.inputmethod.latin E/RichInputConnection: Unable to connect to the editor to retrieve text.
01-22 17:24:58.768 1609-1609/com.android.inputmethod.latin W/RichInputConnection: Unable to connect to the editor. Setting caps mode without knowing text.
01-22 17:24:58.803 2500-2500/com.android.chrome W/IInputConnectionWrapper: finishComposingText on inactive InputConnection