Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/145.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
尝试在Chrome中调试时,React本机Android崩溃_Android_React Native - Fatal编程技术网

尝试在Chrome中调试时,React本机Android崩溃

尝试在Chrome中调试时,React本机Android崩溃,android,react-native,Android,React Native,我有一个React原生应用程序,它在iOS上运行,我正在尝试为Android安装并运行它。我已经在emulator中启动并运行了应用程序,我想在Chrome中调试它以解决一些问题 当我打开应用程序内开发工具并单击Chrome中的调试选项时,问题就出现了。应用程序崩溃了几秒钟,我收到一条警告消息,上面写着“不幸的是,我的应用程序已停止”。然后,应用程序立即返回红色屏幕,并显示“无法连接远程调试器” 我相信我已经按照指示安排好了一切 有没有人见过这种问题?如果有,有没有办法解决 谢谢 我也有这个问题

我有一个React原生应用程序,它在iOS上运行,我正在尝试为Android安装并运行它。我已经在emulator中启动并运行了应用程序,我想在Chrome中调试它以解决一些问题

当我打开应用程序内开发工具并单击Chrome中的调试选项时,问题就出现了。应用程序崩溃了几秒钟,我收到一条警告消息,上面写着“不幸的是,我的应用程序已停止”。然后,应用程序立即返回红色屏幕,并显示“无法连接远程调试器”

我相信我已经按照指示安排好了一切

有没有人见过这种问题?如果有,有没有办法解决


谢谢

我也有这个问题(这就是为什么我看到了你的帖子)。你是否有机会将你的项目建立在?在启动devtools时,我遇到过,并且遇到了与崩溃完全相同的问题


现在,我已经使用
react native init
从头开始重新构建了我的项目,问题似乎已经解决了

Android上也有同样的问题。我刚刚开始了一个使用
react native init
的项目,并开始学习Facebook教程

当我在没有调试的情况下运行应用程序时,它工作正常。如果我启用远程调试JS,它将在1分钟后崩溃(不执行任何操作)

在三星Galaxy S5、react native cli 0.2.0、react native 0.32.1、Windows 7、Chrome 53上进行测试

在Android Studio中,我发现了以下stacktrace:

09-08 13:25:06.322 31080-3735/com.tutorialproject W/libc: pthread_create failed: couldn't allocate 1064960-byte stack: Out of memory
09-08 13:25:06.322 31080-3735/com.tutorialproject E/art: Throwing OutOfMemoryError "pthread_create (1040KB stack) failed: Try again"
09-08 13:25:06.332 31080-3735/com.tutorialproject E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
    Process: com.tutorialproject, PID: 31080
    java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
        at java.lang.Thread.nativeCreate(Native Method)
        at java.lang.Thread.start(Thread.java:1063)
        at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:920)
        at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1338)
        at okhttp3.ConnectionPool.put(ConnectionPool.java:135)
        at okhttp3.OkHttpClient$1.put(OkHttpClient.java:149)
        at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:188)
        at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129)
        at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
        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:109)
        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:124)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
        at okhttp3.RealCall.access$100(RealCall.java:33)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at java.lang.Thread.run(Thread.java:818)
09-08 13:25:06.372 31080-31080/com.tutorialproject D/SensorManager: unregisterListener ::   
09-08 13:25:06.852 31080-31185/com.tutorialproject W/unknown:React: Tried to enqueue runnable on already finished thread: 'native_modules... dropping Runnable.
09-08 13:25:06.852 31080-31185/com.tutorialproject W/MessageQueue: Handler (com.facebook.react.bridge.queue.MessageQueueThreadHandler) {246b7490} sending message to a Handler on a dead thread
       java.lang.IllegalStateException: Handler (com.facebook.react.bridge.queue.MessageQueueThreadHandler) {246b7490} sending message to a Handler on a dead thread
           at android.os.MessageQueue.enqueueMessage(MessageQueue.java:325)
           at android.os.Handler.enqueueMessage(Handler.java:631)
           at android.os.Handler.sendMessageAtTime(Handler.java:600)
           at android.os.Handler.sendMessageDelayed(Handler.java:570)
           at android.os.Handler.post(Handler.java:326)
           at com.facebook.react.bridge.queue.MessageQueueThreadImpl.runOnQueue(MessageQueueThreadImpl.java:61)
           at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
           at android.os.Handler.handleCallback(Handler.java:739)
           at android.os.Handler.dispatchMessage(Handler.java:95)
           at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
           at android.os.Looper.loop(Looper.java:145)
           at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
           at java.lang.Thread.run(Thread.java:818)
09-08 13:25:06.862 31080-3792/com.tutorialproject W/ContextImpl: Failed to ensure directory: /storage/extSdCard/Android/data/com.tutorialproject/cache
09-08 13:25:11.362 31080-31088/com.tutorialproject W/art: Suspending all threads took: 5.930ms
这是一个非常简单的项目,只有几个文本组件,所以我不做任何请求。所有的网络通信都是由于远程调试

由于这是一个OutOfMemory问题,我尝试将
android:largeHeap=“true”
添加到Manifest.xml中,但没有任何改变。该应用程序达到32Mb的消耗量并死亡

我已经修改了应用程序,所以它加载了5000次带有图像的组件。禁用调试后,应用程序最多可分配70Mb的内存,运行正常。我可以在屏幕上滚动,没有任何崩溃。当我启用远程调试时,我会工作一段时间,直到它试图分配更多内存并再次崩溃。我可以在启用调试的情况下再次启动应用程序,它启动得很好,但过了一会儿又崩溃了


我想React Native remote debugging功能在分配新内存方面有问题(而且由于某些原因,即使在应用程序停止时,它也会消耗大量内存)。

Hmm,我想我说得太快了——即使在我从头开始构建的项目中,它现在又露出了丑陋的脑袋。糟糕。。。我还没有使用React Native Material工具包演示。奇怪的是,它为同一个项目的同事工作,但不是为我工作。。。这让我相信这是一个破坏我电脑的环境因素…好吧,在我开始使用material kit之后,我的调试器也无法连接!你能解决这个问题吗?我现在看到了类似的情况。