Reputation: 3959
I am using expo "Bare workflow" in order to connect my react app to firebase.
This is what I have done so far following this tutorial:
I had an existing firebase project which I am trying to connect to.
I clicked on the android icon and registered the app also download the configuration part, I have even added Firebase SDK and applied the plugins, When I use
var admin = require("firebase-admin");
then I get this error:
in my app/build.gradle I do get the following error at:
import com.android.build.OutputFile
the error is: cannot resolve symbol "build"
how can I solve this ?
I also clicked on the file and pressed on invalidate/ cache restart, and I did that too when I click on run on my android studios on the edit configuration window that pops open it tells me Error: AndroidManifest.xml doesn't exist or has incorrect root tag
when I click File->Project structure, there I see under project SDK that no SKD has been selected.
so I am not sure what is causing this problem.
Upvotes: 0
Views: 736
Reputation: 153
Create your Firebase instance, then go to the left side where it says "Real Time Database" and set that up. Make sure you have react-native-firebase installed (expo install react-native-firebase
). Create a config.js file that looks like this:
import Firebase from 'firebase';
let config = {
apiKey: '',
authDomain: '',
databaseURL: '',
projectId: '',
storageBucket: '',
messagingSenderId: ''
};
let app = Firebase.initializeApp(config);
export const db = app.database();
Fill this in with your information, which can be found in the firebase console after creating a web app for your firebase project. (</>
button).
Now that you have your firebase linked to your expo project, import your database using import { db } from '{path to your config file}';
Let me know if you need help pushing and pulling data from your RTDB instance.
Upvotes: 1