Firebase / Android - 定期丢失数据库连接 [英] Firebase/Android - Regularly losing database connection
问题描述
全新安装后,一切正常:
用户可以注册或登录,数据检索应该像它应该,超快,超级干净。 yay。
然后,通过android studio重新启动后,数据库的东西不再工作了。重新启动的数量是不一样的,我找不到一个规则或这样的。如果我卸载并重新安装apk(仍然通过Android Studio)它再次工作。
我正在监视auth状态,用户保持登录状态,也没有firebase错误。
$ b
我得到大量的 E / DynamiteModule:无法加载模块描述符类:
但显然这不是一个错误(只是提到它,因为我得到了连续20多行的错误。
任何想法我应该开始寻找?
$ b
app.gradle
android {
compileSdkVersion 23
buildToolsVersion23.0.3
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 23
...
}
...
}
...
依赖关系{
编译fileTree(dir:'libs',include:['* .jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile'com.android.support:design:23.4.0'
compile'com .google.firebase:firebase-core:9.0.1'
compile'com.google.firebase:firebase-database:9.0.1'
compile'com.google.firebase:firebase-storage:9.0 .1'
compile'com.google.firebase:firebase-auth:9.0.1'
compile'com.google.firebase:firebase-messaging:9.0.1'
compile'com .android.support.constraint:constraint-layout:1.0.0-alpha1'
compile'cn.pedant.sweetalert:library:1.3'
testCompile'junit:junit:4.12'
}
Firebase数据库规则
{
rules:{
.read:auth!= null,
.write:auth!= null
}
}
可能遇到由auth令牌刷新失败导致的已知问题讨论这里。尝试使用 FirebaseDatabase.getInstance()。setLogLevel(Logger.Level.DEBUG)
启用调试级别日志记录,并将输出与上面链接的讨论中包含的示例进行比较。特别是,查找错误获取令牌:发生内部错误。[内部错误]。如果您看到这一点,请按照此处提供的说明修复您的Google服务。 json文件。
I followed the docs for Firebase Auth and Database.
Everything works fine after a fresh install:
The user can register or log in, the data is retrieved like it should, written like it should, super fast, super clean. yay.
And then, after a few restarts via android Studio, the database stuff does not work anymore. The amount of restarts varies, I could not find a rule or such. If I uninstall and reinstall the apk (still via Android Studio) it works again.
I'm monitoring the auth state, the user stays logged in, there are also no firebase error at all.
I get a ton of E/DynamiteModule: Failed to load module descriptor class:
but apparently this is not an error (just mentioning it because I get 20+ consecutive lines of that "error".
Any idea where I should start looking?
app.gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 23
...
}
...
}
...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.firebase:firebase-core:9.0.1'
compile 'com.google.firebase:firebase-database:9.0.1'
compile 'com.google.firebase:firebase-storage:9.0.1'
compile 'com.google.firebase:firebase-auth:9.0.1'
compile 'com.google.firebase:firebase-messaging:9.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
compile 'cn.pedant.sweetalert:library:1.3'
testCompile 'junit:junit:4.12'
}
Firebase database rules
{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}
It sounds like you may be experiencing a known problem caused with auth token refresh failure discussed here. Try enabling debug level logging using FirebaseDatabase.getInstance().setLogLevel(Logger.Level.DEBUG)
and compare the output with the samples included in the discussion linked above. In particular, look for "Error fetching token: An internal error has occured. [ Internal error. ]". If you see that, follow the instructions provided here to fix your google-services.json file.
这篇关于Firebase / Android - 定期丢失数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!