Solution 1 :
This might be hard. You did not mention version of Android Studio and which android device and os version have you run. I suggest to try install another virtual device and check. Here you have nice tutorial for Mac.
If this will not work there is a page for troubleshooting emulator if you do not find your issue there you can report a bug.
Good luck!
Problem :
I am trying to run a transaction with firestore that will increment a vote counter.
I am running the following code:
Firestore.instance.runTransaction((Transaction tx) async {
DocumentSnapshot postSnapshot = await tx.get(postRef);
if (postSnapshot.exists) {
//print(postSnapshot.data['Votes']);
await tx.update(postRef, <String, dynamic>{'Votes': postSnapshot.data['Votes'] + 1})
.catchError((e) {print(e);});
}
}).catchError((e) {
print(e);
});
Sometimes, this works fine, but sometimes it causes my android emulator to crash silently – the app closes and the console says Lost connection to device
. Neither of the catchError
statements prints, and there is no output from the console. Flutter doctor reports no issues. This does not seem to be an issue on iOS, although it is hard to tell since the error is sporadic.
My version of flutter is Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-US)
Does anyone know why this might be happening? Is it an issue with flutter or with the way I’m running the transaction? Any help would be greatly appreciated, thanks!
Comments
Comment posted by gollyzoom
I am using Android Studio 3.5, I am emulating on a Pixel 2 with android 9.0, and API 28.