在Android上使用长字符串的Firebase异常 [英] Firebase exception with long Strings on Android
问题描述
我想将图片保存为Firebase作为字符串。对于这个我把它编码为一个Base64字符串。
对于较小的图像(例如15128个字符的字符串是可以的),一切工作正常,但对于较大的图像我得到一个异常。 / b>
这里是堆栈跟踪,这个图像是在Base64编码后编码34807个字符的长度:
07-10 09:45:38.414 879-896 / com.firebase.androidchat E / DefaultRunLoop:Firebase runloop中的未捕获异常。请报告到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)
在com.firebase.client.core.PersistentConnection.put(PersistentConnection.java:307)
在com.firebase.client.core.PersistentConnection.put(PersistentConn ection.java:303)
在com.firebase.client.core.Repo.setValue(Repo.java:215)
在com.firebase.client.Firebase $ 1.run(Firebase.java:427 )
我是否达到了允许的最大Firebase字符串大小,还是Android SDK中的错误?任何解决方法?
Firebase dev这里。最新版本的SDK(v1.0.2)应该可以解决这个问题。你可以试一下,让我知道如果解决了吗?
https://www.firebase.com/docs/downloads.html
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 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)
Am I hitting the maximum allowed Firebase String size or is it a bug in the Android SDK? any work-around?
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
这篇关于在Android上使用长字符串的Firebase异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!