1

I have an Android FireBase problem. I have collection of base64 encoded images, about 200MB of them. I pushed the images up with one device and can see them on the website. Now from another device I'm trying to retrieve them using f.addValueEventListener(handler). My handler has a onDataChange listener and the error occurs a minute after waiting to get the data back. It never returns and I get this error:

02-01 17:32:04.638 24146-24220/thor.bluefinllc.com.bluefinsurveyroof E/AndroidRuntime: FATAL EXCEPTION: TubeSockReader-3
   Process: thor.bluefinllc.com.bluefinsurveyroof, PID: 24146
   java.lang.OutOfMemoryError: Failed to allocate a 21856 byte allocation with 1888 free bytes and 1888B until OOM
       at java.nio.CharBuffer.put(CharBuffer.java:501)
       at java.nio.charset.CharsetDecoder.allocateMore(CharsetDecoder.java:228)
       at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:188)
       at com.firebase.tubesock.MessageBuilderFactory$TextBuilder.decodeString(MessageBuilderFactory.java:109)
       at com.firebase.tubesock.MessageBuilderFactory$TextBuilder.appendBytes(MessageBuilderFactory.java:86)
       at com.firebase.tubesock.WebSocketReceiver.appendBytes(WebSocketReceiver.java:104)
       at com.firebase.tubesock.WebSocketReceiver.run(WebSocketReceiver.java:69)
       at com.firebase.tubesock.WebSocket.runReader(WebSocket.java:372)
       at com.firebase.tubesock.WebSocket.access$000(WebSocket.java:30)
       at com.firebase.tubesock.WebSocket$2.run(WebSocket.java:108)
Clay
  • 4,700
  • 3
  • 33
  • 49
  • Yeah... that sounds like a very bad idea. While it is technically possible to store images in the Firebase database, it is a JSON database and not well suited for doing this at scale. So: find a good image storage solution, store the images there and then store the URLs in Firebase. – Frank van Puffelen Feb 02 '16 at 01:20
  • See http://stackoverflow.com/questions/35091003/uploading-images-to-firebase/35093384#35093384 and http://stackoverflow.com/questions/35076473/how-do-you-save-a-file-to-a-firebase-hosting-folder-location-for-images-through/35076653#35076653 – Frank van Puffelen Feb 02 '16 at 01:22
  • That's too bad! It was working great uploading and even works well with 10 to 20 photos, but 200 to 300 seems to break things. I'm fine moving my photos to file storage, but I hope that this isn't a problem with the amount of data I'm trying to pull down at one time. – user2659261 Feb 03 '16 at 14:06
  • If you download one image at a time, you'll likely be fine. Since you're migrating the data, you might also consider running in a regular JVM on your desktop, which likely has a bit more memory than an Android device (although that's not certain these days :-) ). – Frank van Puffelen Feb 03 '16 at 15:18

0 Answers0