【问题标题】:React native android app Fatal exception on start and I cant trace the problemReact native android app Fatal exception on start,我无法追踪问题
【发布时间】:2019-11-16 21:57:09
【问题描述】:

React Native Android 应用程序,编译良好,安装 APK 但在运行应用程序时立即出现致命异常,我无法追踪问题,我有一个错误的 logcat 视图,但不知道如何解决它。

我尝试调试,但它立即关闭,所以我没有机会这样做。我也尝试搜索特定错误,但没有找到合适的东西。

07-06 20:09:56.697 27444 27479 E AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
07-06 20:09:56.697 27444 27479 E AndroidRuntime: Process: com.t2capp, PID: 27444
07-06 20:09:56.697 27444 27479 E AndroidRuntime: java.lang.IllegalStateException: closed
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at okio.RealBufferedSource.rangeEquals(RealBufferedSource.java:398)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at okio.RealBufferedSource.rangeEquals(RealBufferedSource.java:392)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at okhttp3.internal.Util.bomAwareCharset(Util.java:412)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at okhttp3.ResponseBody.string(ResponseBody.java:173)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at com.facebook.react.devsupport.DevServerHelper$8.onResponse(DevServerHelper.java:485)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
07-06 20:09:56.697 27444 27479 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:784)
07-06 20:09:56.701  1170  6229 W ActivityManager:   Force finishing activity com.t2capp/.MainActivity
07-06 20:09:56.701 27444 27476 W unknown:ReconnectingWebSocket: Couldn't connect to "ws://localhost:8081/message?device=LLD-L31%20-%208.0.0%20-%20API%2026&app=com.t2capp&clientid=DevSupportManagerImpl", will silently retry
07-06 20:09:56.771  1170  1300 W InputDispatcher: channel '4439e16 com.t2capp/com.t2capp.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
07-06 20:09:56.771  1170  1300 E InputDispatcher: channel '4439e16 com.t2capp/com.t2capp.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

该应用程序曾经可以工作,我最近又回到它继续并遇到了这个问题,真的卡在哪里出了问题。我认为最初是 firebase 问题,但连接时似乎并非如此(我通过创建新的应用程序包并启动它来使用 firebase 测试)

【问题讨论】:

    标签: android firebase react-native exception


    【解决方案1】:

    你的日志是unknown:ReconnectingWebSocket: Couldn't connect to "ws://localhost:8081/ ...

    您似乎已经为您的开发环境(在您自己的机器上,本地主机上)硬编码了 Firebase 套接字 URL。

    您必须为生产配置 Firebase。

    基本上可以这样:

    语言:javascript

    if (process.env.NODE_ENV === 'development') {
        // define here your connection for development
    } else {
        // define here your connection for production
    }
    

    【讨论】:

      猜你喜欢
      • 2020-03-09
      • 1970-01-01
      • 2017-12-05
      • 2021-12-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-12
      相关资源
      最近更新 更多