[RESOLVIDO] Aplicação fecha quando abro outra Activity

Olá estou com problema no meu projeto, eu adicionei o Firebase para poder usar do recurso de redefinição de senha, depois de colocar todo o codigo o ao clicar no TextView que levaria até a Activity de Recuperação de Senha minha aplicação fecha, alguém saberia o que pode ser ?

Código da Activity Recuperação de Senha:
public class EsqueciSenha extends AppCompatActivity {

private Toolbar toolbar;
private Button ResetPasswordSendEmailButton;
private EditText ResetEmailInput;
private FirebaseAuth firebaseauth;

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

    firebaseauth = FirebaseAuth.getInstance();

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setTitle("Resetar Senha");

    ResetPasswordSendEmailButton = (Button)findViewById(R.id.bntEnviar);
    ResetEmailInput = (EditText)findViewById(R.id.editDigiteEmail);

    ResetPasswordSendEmailButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String userEmail = ResetEmailInput.getText().toString();
            if(TextUtils.isEmpty(userEmail)){
                Toast.makeText(EsqueciSenha.this, "Por favor digite um email valido", Toast.LENGTH_SHORT).show();
            }else{
                firebaseauth.sendPasswordResetEmail(userEmail).addOnCompleteListener(new OnCompleteListener<Void>() {
                    @Override
                    public void onComplete(@NonNull Task<Void> task) {
                        if(task.isSuccessful()){
                            Toast.makeText(EsqueciSenha.this, "Email enviado com sucesso", Toast.LENGTH_SHORT).show();
                            startActivity(new Intent(EsqueciSenha.this, MainActivity.class));
                        }else{
                            String message = task.getException().getMessage();
                            Toast.makeText(EsqueciSenha.this, "Não existe uma conta com esse email" + message, Toast.LENGTH_SHORT).show();
                        }
                    }
                });
            }
        }
    });
}

}

Erro mostrado pelo Android Studio:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.motobrothers, PID: 12226
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.motobrothers/com.example.motobrothers.EsqueciSenha}: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.example.motobrothers. Make sure to call FirebaseApp.initializeApp(Context) first.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.example.motobrothers. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@19.3.0:184)
at com.google.firebase.auth.FirebaseAuth.getInstance(com.google.firebase:firebase-auth@@19.3.0:1)
at com.example.motobrothers.EsqueciSenha.onCreate(EsqueciSenha.java:32)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

mostra seu gradle (app e project)

APP

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.example.motobrothers"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.navigation:navigation-fragment:2.0.0'
    implementation 'androidx.navigation:navigation-ui:2.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.firebase:firebase-auth:19.3.0'
    implementation 'com.google.firebase:firebase-core:17.3.0'

}

PROJECT

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    
    repositories {
        google()
        jcenter()
        
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.2'
        classpath 'com.google.gms:google-services:4.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        
    }
}


task clean(type: Delete) {
    delete rootProject.buildDir
}

Em app, insere essa linha depois de apply plugin: 'com.android.application' :

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

obs: quando for postar código aqui, seleciona ele todo e clica em </>

1 curtida

Ainda continua dando erro:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.motobrothers, PID: 13059
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.motobrothers/com.example.motobrothers.EsqueciSenha}: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6541)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
     Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
        at androidx.appcompat.app.AppCompatDelegateImpl.setSupportActionBar(AppCompatDelegateImpl.java:421)
        at androidx.appcompat.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:150)
        at com.example.motobrothers.EsqueciSenha.onCreate(EsqueciSenha.java:35)
        at android.app.Activity.performCreate(Activity.java:6975)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
        at android.os.Handler.dispatchMessage(Handler.java:105) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6541) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

O erro agora é outro:

Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.

como está o seu styles?

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">#d0d6d3</item>
</style>

<style name="MyEditTextTheme">
    <item name="colorControlNormal">#d0d6d3</item>
    <item name="colorControlActivated">#7df869</item>
    <item name="colorControlHighlight">@color/accent_material_light</item>
</style>

<style name="CheckBox">
    <item name="colorControlNormal">#d0d6d3</item>
    <item name="colorControlActivated">#7df869</item>
    <item name="colorControlHighlight">@color/accent_material_light</item>
</style>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
Linkify.addLinks(myTextView, Linkify.ALL);

ta, agora mostra o xml da sua activity

Consegui resolver muito obrigado mesmo <3

o que era?

Eu retirei o codigo da toolbar, ela não vai ser necessária no meu código então resolvi retirar e funcionou, vou te enviar o xml com a toolbar para você dar uma olhada

package com.example.motobrothers;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.app.Notification;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

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

public class EsqueciSenha extends AppCompatActivity {

private Toolbar toolbar;
private Button ResetPasswordSendEmailButton;
private EditText ResetEmailInput;
private FirebaseAuth firebaseauth;

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

    firebaseauth = FirebaseAuth.getInstance();

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setTitle("Resetar Senha");

    ResetPasswordSendEmailButton = (Button)findViewById(R.id.bntEnviar);
    ResetEmailInput = (EditText)findViewById(R.id.editDigiteEmail);

    ResetPasswordSendEmailButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String userEmail = ResetEmailInput.getText().toString();
            if(TextUtils.isEmpty(userEmail)){
                Toast.makeText(EsqueciSenha.this, "Por favor digite um email valido", Toast.LENGTH_SHORT).show();
            }else{
                firebaseauth.sendPasswordResetEmail(userEmail).addOnCompleteListener(new OnCompleteListener<Void>() {
                    @Override
                    public void onComplete(@NonNull Task<Void> task) {
                        if(task.isSuccessful()){
                            Toast.makeText(EsqueciSenha.this, "Email enviado com sucesso", Toast.LENGTH_SHORT).show();
                            startActivity(new Intent(EsqueciSenha.this, MainActivity.class));
                        }else{
                            String message = task.getException().getMessage();
                            Toast.makeText(EsqueciSenha.this, "Não existe uma conta com esse email" + message, Toast.LENGTH_SHORT).show();
                        }
                    }
                });
            }
        }
    });
}

}

Boa!!