我想将图像作为字符串保存到 Firebase。为此,我将其编码为 Base64 字符串。
对于较小的图像,一切正常(例如,15128 个字符的字符串可以),但对于较大的图像,我得到一个例外。
这是堆栈跟踪,此图像在 Base64 编码后编码为 34807 个字符:
07-10 09:45:38.414 879-896/com.firebase.androidchat E/DefaultRunLoop: Uncaught exception in Firebase runloop. Please report to support@firebase.com
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)
我是达到允许的最大 Firebase 字符串大小还是 Android SDK 中的错误?任何解决方法?