Reputation: 7366
I want to save an image to Firebase as a String. For this I encode it as a Base64 String.
Everything works fine for smaller images (eg a 15128 characters String is ok) but for larger ones I get an exception.
Here's the stack trace, this image is 34807 characters long encoded after Base64 encoding:
07-10 09:45:38.414 879-896/com.firebase.androidchat E/DefaultRunLoop: Uncaught exception in Firebase runloop. Please report to [email protected]
java.lang.StringIndexOutOfBoundsException: length=34807; regionStart=32768; regionLength=16384
at java.lang.String.startEndAndLength(String.java:583)
at java.lang.String.substring(String.java:1464)
at com.firebase.client.utilities.Utilities.splitIntoFrames(Utilities.java:85)
at com.firebase.client.realtime.WebsocketConnection.send(WebsocketConnection.java:159)
at com.firebase.client.realtime.Connection.sendData(Connection.java:200)
at com.firebase.client.realtime.Connection.sendRequest(Connection.java:89)
at com.firebase.client.core.PersistentConnection.sendAction(PersistentConnection.java:744)
at com.firebase.client.core.PersistentConnection.sendPut(PersistentConnection.java:697)
at com.firebase.client.core.PersistentConnection.putInternal(PersistentConnection.java:684)
at com.firebase.client.core.PersistentConnection.put(PersistentConnection.java:307)
at com.firebase.client.core.PersistentConnection.put(PersistentConnection.java:303)
at com.firebase.client.core.Repo.setValue(Repo.java:215)
at com.firebase.client.Firebase$1.run(Firebase.java:427)
Am I hitting the maximum allowed Firebase String size or is it a bug in the Android SDK? any work-around?
Upvotes: 1
Views: 1146
Reputation: 1432
This is just issue of older version of firebase database dependency of gradle file just update it with latest version... THAT'S IT
Upvotes: 0
Reputation: 1434
Firebase dev here. The latest release of the SDK (v1.0.2) should fix this issue. Can you give it a try and let me know if it's resolved?
https://www.firebase.com/docs/downloads.html
Upvotes: 1