Problem with the FirebaseApp call

0

I have a fragment that performs user registration and login using Firebase. However, I'm having trouble with the initializeApp (Context) method. Here is the code:

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.fragment_perfil, container, false);

    FirebaseApp.initializeApp(getContext());
    mAuth = FirebaseAuth.getInstance();

The error message:

  

Default FirebaseApp is not initialized in this process   com.redentor.mikha.scientia. Make sure to call   FirebaseApp.initializeApp (Context) first.                                                                                  at com.google.firebase.FirebaseApp.getInstance (Unknown Source)

    
asked by anonymous 22.09.2017 / 22:48

1 answer

0

First of all try to see if you have any updates to the firebase API, and in the code remove:

FirebaseApp.initializeApp(getContext());
mAuth = FirebaseAuth.getInstance();

And add just one:

FirebaseDatabase fbDatabase = FirebaseDatabase.getInstance();

    
23.09.2017 / 00:09