我的 React Native 应用程序有一些本地实现,我在其中运行 OpenCV 和 Tensorflow。没有 Android Profiling,应用程序运行顺畅,不会崩溃。启用 Android Profiling 后,在调用本机函数的那一刻,应用程序会冻结并显示以下错误消息。
StudioProfiler: Studio Profilers encountered an unexpected error.
Consider reporting a bug, including logcat output below.
See also: https://developer.android.com/studio/report-bugs.html#studio-bugs
Could not track an OkHttp3 request
java.io.IOException: closed
at okio.RealBufferedSink$1.write(RealBufferedSink.java:191)
at com.facebook.react.modules.network.CountingOutputStream.write(CountingOutputStream.java:53)
at com.facebook.react.modules.network.ProgressRequestBody$1.write(ProgressRequestBody.java:61)
at okio.Okio$1.write(Okio.java:79)
at okio.RealBufferedSink.flush(RealBufferedSink.java:216)
at com.facebook.react.modules.network.ProgressRequestBody.writeTo(ProgressRequestBody.java:54)
at com.android.tools.profiler.agent.okhttp.OkHttp3Interceptor.trackRequest(OkHttp3Interceptor.java:91)
at com.android.tools.profiler.agent.okhttp.OkHttp3Interceptor.intercept(OkHttp3Interceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:179)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:129)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
然后,会出现像下面这样的其他警告,如果没有探查器,这些警告就不会发生。
Skipped 80 frames! The application may be doing too much work on its main thread.