[Firebase] Firestore dont work on Android


#1

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


#2

what’s the error that you get?


#3

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.


#4

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?


#5

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


#6

Did you resolved it? :smiley:


#7

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.


#8

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


#9

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


#10

@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?


#11

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


#12

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…


#13

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.


#14

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


#15

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


#16

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.


#17

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 https://expo.canny.io/feature-requests/p/full-native-firebase-integration

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


#18

@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:


#19

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