title: FirebaseApp not initializing despite FirebaseApp.initializeApp() being called in Application class
body: <p>I am creating an Android application and I'm currently trying to implement user authentication using Firebase. As far as I can tell, my app is connected to my Firebase server.</p>
  
  <p>I encounter a runtime error when attempting to switch from the SignIn activity to the SignUp activity via a button press. The app crashes and I encounter a runtime error.</p>
  
  <p>So far as I can tell, the runtime error is from the SignUp activity's <code>onCreate()</code> call when I attempt to initialize a <code>FirebaseAuth</code> object with <code>FirebaseAuth.getInstance()</code>. This call fails due to </p>
  
  <pre><code>java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process seniordesign.phoneafriend. Make sure to call FirebaseApp.initializeApp(Context).
  </code></pre>
  
  <p>However, I make this call in my Application class' <code>onCreate()</code> method which I thought would be fine. I added the <code>initalizeApp()</code> call to the SignUp's <code>onCreate()</code> call but no dice. I've looked for others with this issue but have not found anything similar. Thanks for any help.</p>
  
  <p>AndroidManifest.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="seniordesign.phoneafriend"&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"
          android:name="seniordesign.phoneafriend.PhoneAFriend"&gt;
          &lt;activity android:name=".SignIn"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity android:name=".SignUp"&gt;&lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>PhoneAFriend.java (My Application class)</p>
  
  <pre><code>public class PhoneAFriend extends Application {
  
      public void onCreate(){
          super.onCreate();
          Firebase.setAndroidContext(this);
          FirebaseApp.initializeApp(this);
      }
  }
  </code></pre>
  
  <p>SignUp.java</p>
  
  <pre><code>public class SignUp extends AppCompatActivity {
      protected Firebase ref;
      protected EditText emailText;
      protected EditText passText;
      protected EditText confirmText;
      protected Button button;
      protected SignUp thisContext;
  
      protected FirebaseAuth auth;
      protected FirebaseAuth.AuthStateListener authListener;
      private View.OnClickListener onClickListener;
  
      public static Intent intent;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_signup);
          ref = new Firebase("https://phoneafriend-7fb6b.firebaseio.com");
          emailText = (EditText) findViewById(R.id.signup_emailText);
          passText = (EditText) findViewById(R.id.signup_passwordText);
          confirmText = (EditText) findViewById(R.id.signup_passwordConfirm);
          intent = new Intent(this, SignIn.class);
          //Tried this already
          //FirebaseApp.initializeApp(this);
          auth = FirebaseAuth.getInstance();
  
  
          button = (Button) findViewById(R.id.signup_button);
          onClickListener = new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  createUser(view);
                  Log.v("SignUp Button" , "Clicked; Attempting to create user");
              }
          };
          button.setOnClickListener(onClickListener);
  
          authListener = new FirebaseAuth.AuthStateListener() {
              @Override
              public void onAuthStateChanged( FirebaseAuth firebaseAuth) {
                  FirebaseUser user = firebaseAuth.getCurrentUser();
                  if (user != null) {
                      // User is signed in
                      Log.d("FirebaseAuth", "onAuthStateChanged:signed_in:" + user.getUid());
                  } else {
                      // User is signed out
                      Log.d("FirebaseAuth", "onAuthStateChanged:signed_out");
                  }
                  // ...
              }
          };
          thisContext = this;
  
      }
      @Override
      public void onStart(){
          super.onStart();
          //auth.addAuthStateListener(authListener);
      }
  
      @Override
      public void onStop(){
          super.onStop();
          if(authListener != null) {
              //auth.removeAuthStateListener(authListener);
          }
      }
  
      protected void createUser(View view){
          String cString = null;
          String pString = null;
          String eString  = emailText.getText().toString();
          if(passText.getText() != null &amp;&amp; confirmText.getText() != null) {
              pString = passText.getText().toString();
              cString = confirmText.getText().toString();
              Log.v("SignUP: Pass Null check" , "Pass" );
              if (emailText.getText() != null &amp;&amp; pString.equals(cString) &amp;&amp; passText.getText() != null) {
                  Log.v("SignUP: Sign up check " , "Pass");
                  auth.createUserWithEmailAndPassword(emailText.getText().toString() , passText.getText().toString())
                          .addOnCompleteListener(this, new OnCompleteListener&lt;AuthResult&gt;() {
                              @Override
                              public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                                  Log.v("createUser complete" , "status: " + task.isSuccessful());
                                  if(task.isSuccessful()){
                                      startActivity(SignUp.intent);
                                  }
                              }
  
                          });
  
              }
          }
  
          return;
      }
  }
  </code></pre>