I am trying to use google firebase realtime database. My users can create events which I want to have on the database as a separate table as well as in the user class as a list. This is what I use to write the events to the database and where the exception occurs:
mDatabase.child("users").child(ResourceManager.getUser().getId()).child("events").setValue(event);
mDatabase.child("events").setValue(ResourceManager.getAllEvents());
The problem is that when I try to save the created event I start getting messages that the garbage collection is working few times and after that the same exception printed 100 times at the end of it the app restarts.
06-30 18:38:19.555 15005-15005/tvfriends.kolio.com.tvproba E/AndroidRuntime: at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzav(Unknown Source)
at com.google.firebase.database.DatabaseReference.zza(Unknown Source)
at com.google.firebase.database.DatabaseReference.setValue(Unknown Source)
at tvfriends.kolio.com.tvproba.HostActivity.onClick(HostActivity.java:109)
at android.view.View.performClick(View.java:5609)
at android.view.View$PerformClick.run(View.java:22238)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6044)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Also at the end of the top Exception I get another one
06-30 18:38:21.478 15005-15005/tvfriends.kolio.com.tvproba D/Error: ERR: TOTAL BYTES WRITTEN: 13034964
06-30 18:38:21.484 15005-15005/tvfriends.kolio.com.tvproba E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 13035048)
06-30 18:38:21.485 15005-15005/tvfriends.kolio.com.tvproba E/AndroidRuntime: Error reporting crash
android.os.TransactionTooLargeException: data parcel size 13035048 bytes
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:615)
at android.app.ActivityManagerProxy.handleApplicationCrash(ActivityManagerNative.java:5100)
at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:97)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
In my Event class I have this variables which I try to store:
private TVEvent tvEvent;
private User host;
private long date;
private String location;
private TVSet tvSet;
private List<User> attending;
private int eventStatus;
TVEvent, TVSet and User have one bitmap each in them and mostle primitive data. So what is the problem here? Any help is deeply appreciated.
EDIT
Here is the stackoverflow error:
D/Error: ERR: stack=java.lang.StackOverflowError: stack size 8MB
at java.lang.reflect.Method.invoke(Native Method)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaw(Unknown Source)
at com.google.android.gms.internal.zzaix.zzaD(Unknown Source)
at com.google.android.gms.internal.zzaix$zza.zzaE(Unknown Source)
at com.google.android.gms.internal.zz
06-30 18:38:21.447 15005-15012/tvfriends.kolio.com.tvproba W/art: Suspending all threads took: 64.352ms
06-30 18:38:21.478 15005-15005/tvfriends.kolio.com.tvproba D/Error: ERR: TOTAL BYTES WRITTEN: 13034964
The size of the data you are attempting to store with setValue()
is probably too large, most likely caused by the bitmap data.
Data can be passed between Android components using Parcels, but the amount of data is limited to 1MB. The TransactionTooLargeException occurred because some component, either one of yours or one of the Firebase components handling your requests, attempted to send a parcel that contained more than 1MB of data. The reports you see of garbage collection running repeatedly is another indication that your processing is requesting large amounts of memory.
Does this new question mean you are no longer seeking help with your other question? If so, cancel the bounty.
The TVSet.compressImage()
method in the code posted for your other question shows that you are Base64 encoding a full size image and storing the result. This is part of the data you are hoping to store in your database. This is not the best use of FirebaseDatabase. Consider using FirebaseStorage to store the images with only the file name or other identifying key stored in your database.
Got this error when saving the Uri of an Image I was saving on Firebase Storage to Firebase Database.
Like @Mwakima mentioned, you cannot save a Uri to Firebase Database.
Solution: Change the type of your uri in the model class to String, get the String from
String uri = taskSnapshot.getDownloadUrl().toString()
When you get the String back from Firebase, pass it to a Uri using
Uri imageUri = Uri.Parse(<your-uri-as-a-string>);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With