在仅在发布时导入firebase时,在启动时反映原生Android应用程序崩溃

时间:2017-03-08 07:31:43

标签: android firebase react-native firebase-realtime-database

我尝试在针对android的react-native应用程序中使用Firebase数据库 我遵循这个tutorial

我使用这个本机反应版本:

react-native-cli: 2.0.1
react-native: 0.42.0

在package.json中:

"firebase": "^3.7.0",

在开发模式下的模拟器或真实设备上,一切都很好但是当我构建一个发布版apk时,它会在应用启动时崩溃

我做了很多测试,问题出在firebase导入

在logcat中,我有这个,有什么想法吗?

03-08 07:52:46.990  6764  6781 E ReactNativeJS: Can't find variable: ie
03-08 07:52:47.000  6764  6781 E ReactNativeJS: Module AppRegistry is not a registered callable module (calling runApplication)
03-08 07:52:47.000  6764  6782 E AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
03-08 07:52:47.000  6764  6782 E AndroidRuntime: Process: com.firebasereactnative, PID: 6764
03-08 07:52:47.000  6764  6782 E AndroidRuntime: com.facebook.react.common.JavascriptException: Can't find variable: ie, stack:
03-08 07:52:47.000  6764  6782 E AndroidRuntime: <unknown>@374:4815
03-08 07:52:47.000  6764  6782 E AndroidRuntime: <unknown>@374:4880
03-08 07:52:47.000  6764  6782 E AndroidRuntime: <unknown>@376:21072
03-08 07:52:47.000  6764  6782 E AndroidRuntime: <unknown>@376:21085
03-08 07:52:47.000  6764  6782 E AndroidRuntime: n@2:557
03-08 07:52:47.000  6764  6782 E AndroidRuntime: i@2:348
03-08 07:52:47.000  6764  6782 E AndroidRuntime: t@2:210
03-08 07:52:47.000  6764  6782 E AndroidRuntime: <unknown>@367:44
03-08 07:52:47.000  6764  6782 E AndroidRuntime: n@2:557
03-08 07:52:47.000  6764  6782 E AndroidRuntime: i@2:348
03-08 07:52:47.000  6764  6782 E AndroidRuntime: t@2:210
03-08 07:52:47.000  6764  6782 E AndroidRuntime: <unknown>@366:135
03-08 07:52:47.000  6764  6782 E AndroidRuntime: n@2:557
03-08 07:52:47.000  6764  6782 E AndroidRuntime: i@2:348
03-08 07:52:47.000  6764  6782 E AndroidRuntime: t@2:210
03-08 07:52:47.000  6764  6782 E AndroidRuntime: <unknown>@12:135
03-08 07:52:47.000  6764  6782 E AndroidRuntime: n@2:557
03-08 07:52:47.000  6764  6782 E AndroidRuntime: i@2:278
03-08 07:52:47.000  6764  6782 E AndroidRuntime: t@2:210
03-08 07:52:47.000  6764  6782 E AndroidRuntime: global code@379:9
03-08 07:52:47.000  6764  6782 E AndroidRuntime: 
03-08 07:52:47.000  6764  6782 E AndroidRuntime:    at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:99)
03-08 07:52:47.000  6764  6782 E AndroidRuntime:    at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:83)
03-08 07:52:47.000  6764  6782 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
03-08 07:52:47.000  6764  6782 E AndroidRuntime:    at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:345)
03-08 07:52:47.000  6764  6782 E AndroidRuntime:    at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:136)
03-08 07:52:47.000  6764  6782 E AndroidRuntime:    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
03-08 07:52:47.000  6764  6782 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:739)
03-08 07:52:47.000  6764  6782 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:95)
03-08 07:52:47.000  6764  6782 E AndroidRuntime:    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
03-08 07:52:47.000  6764  6782 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:158)
03-08 07:52:47.000  6764  6782 E AndroidRuntime:    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
03-08 07:52:47.000  6764  6782 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:818)
03-08 07:52:47.000  1252  2157 W ActivityManager:   Force finishing activity com.firebasereactnative/.MainActivity
03-08 07:52:47.000  1252  2157 W VirtualScreenManagerService: moveTaskBackToDisplayIfNeeded(): top activity or app is null

2 个答案:

答案 0 :(得分:0)

降级到firebase 3.6.5似乎已经为我修复了

答案 1 :(得分:0)

好消息!有用 ! 我初始化一个新的react-native项目并安装最后的firebase版本,现在是3.7.1! 一切都很好

感谢您的帮助