[Firebase] Firestore dont work on Android

Hi, I have a problem on my android phone, but it work on IOS.

This my code

db.collection("users").get().then((querySnapshot) => {
    querySnapshot.forEach((doc) => {
        console.log(`${doc.id} => ${doc.data()}`);
    });
});

Anyone can tell me about this issue or suggest for me a solution.

Thanks

what’s the error that you get?

1 Like

Thank you for response, But It did show anything, maybe code not run on Android. With realtime database it work verry well.

I use:

"jest-expo": "^21.0.2",
"firebase": "^4.6.0",
"react-native": "^0.48.4",
"react": "16.0.0-alpha.12",

Hope you know what happend.

hi @dangtienngoc - its hard to say from the code and forum description what the problem is. Try looking at each function call and seeing that it returns what you expect?

1 Like

I have the same issue here… expo+FIRESTORE only works on ios.

Did you resolved it? :smiley:

On Android it doesn’t through any errors, when you try to query or read from the Firestore.

On iOS it works perfectly fine, I am able to query or read, except after 1 or 2 minutes, I get an error “Can’t find Variable: Image”. Somebody filed an issue for that, a month ago, Firebase team said they will address this issue on their next SDK which is 4.6.1. I have updated my firebase package to 4.6.1 but still see this error.

Could you possibly send us a repo that reproduces the error? :blue_heart:

It doesn’t through an error, it just doesn’t work!

1 Like

@clarktank - ok, can you post an app that has it set up and working on iOS so we can try it on Android and investigate to determine whether it is Expo or Firebase that needs to change?

1 Like

(a link to a Github project would be the best way to do this)

1 Like

here is a link to a Github project. You can read and write to my firebase project! Let me know when you are done with it…

Here is a published expo project called playing-with-firestore. It fetches all the reviews when you click on it. it works on iOS but not on Android.

thank you clark! managed to get it running locally, will investigate

1 Like

I see a warning when running that code on android, but works on ios as you pointed out.

i’ll try this on a react-native project without expo, if that doesn’t work then i’ll open an issue on firebase repo

1 Like

i created a project with react-native init and encountered the exact same warning, so this issue isn’t specific to expo. if you have time, please go ahead and open an issue on the firebase repository, or feel free to dig through the code and find the problem. since the problem is not specific to expo, i don’t have time to investigate any further, sorry! i can create an issue if you don’t get around to it though, let me know if you make one.

there is already opened issue on firebase repo, see link https://github.com/firebase/firebase-js-sdk/issues/283
and this problem was also discussed in expo feature request, here Adding react-native-firebase to Expo | Voters | Expo

I hope it will be solved soon, because my app works properly only on iOS now…

1 Like

@czubocha - sorry to hear that but it’s not an expo-specific problem and we don’t have the time as a company to spend on this right now. i would suggest helping firebase solve the problem, that’s your best bet. this is open source, all of the code is there, you can do your part and pitch in :wink:

I have the exact same issue except it throws an error… think i’m gonna switch to real time data base