React Native Android crashes when trying to debug in Chrome - android

I've got a React Native app that is working for iOS and am trying to get it up and running for Android. I have the app up and running in the emulator and I would like to debug it in Chrome to figure out some issues.
The problem occurs when I open up the in app dev tools and click the Debug in Chrome option the app crashes for a couple seconds and I get an alert message that says "Unfortunately MyApp has stopped." then right after that the app comes back up with the red screen and says "Unable to connect with remote debugger".
I believe I've set up everything as the directions said on this page.
Has anyone seen this kind of issue and if so is there a way to fix it?
Thanks!

Same problem here on Android. I've just started a project with react-native init and begun to follow the Facebook tutorial.
When I run the app without debugging, it works fine. If I enable Debug JS remotely, it crashes after 1 minute (doing nothing).
Testing on Samsung Galaxy S5, react-native-cli 0.2.0, react-native 0.32.1, Windows 7, Chrome 53.
In Android Studio I've found this 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
It's a really simple project, with just a couple of text components, so I'm not doing any request. All the network communication is due the remotely debugging.
Since it's an OutOfMemory problem I've tried to add android:largeHeap="true" to Manifest.xml, but nothing changes. The app reaches the 32Mb consumption and dies.
I've modified the app, so it loads a component with an image 5000 times. With the debugging disabled, the app allocates up to 70Mb and works fine. I can scroll all over the screen and nothing crashes. When I enable the remote debugging, I works for a while, until it tries to allocate more memory and crashes again. I can start again the app with the debugging enabled, and it starts well, but again crashes after a while.
IMHO the React Native remote debugging feature has a problem for allocating new memory (and for some reason it consumes a lot of memory even when the app is stopped).

I had this problem as well (which is why I came across your post). Have you by any chance based your project on the React Native Material Kit Demo? I had, and was having exactly the same problem with crashing when launching devtools.
I've now rebuilt my project from the ground up using react-native init and the problem seems to have gone away.

Related

Does the Google Play Console log all crashes?

I have a crash that has slowly crept up in crash rate over my last few releases. All attempts to fix the crash have proved futile. I suspect that the crash happens in the background and users are not actually seeing the issue, else I would have many more reviews about the app crashing.
Do users still need to tap the the crash module that pops up in order for Google to log the crash or does the crash report get sent automatically at this point?
I can not find a definitive answer to this.
Here is the crash if anyone has ideas. There is a lot of info available on that I have tried as well as anything else I could think of. Dug through every SDK, reverted back to previous target API, turned off features etc etc :(
java.lang.RuntimeException: An error occurred while executing doInBackground()
at
android.os.AsyncTask$3.done(AsyncTask.java:354)
at
java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at
java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at
java.util.concurrent.FutureTask.run(FutureTask.java:271)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at
java.lang.Thread.run(Thread.java:798)
Caused by: java.lang.SecurityException: Caller no longer running, last stopped +2s531ms because: timed out while starting
at
android.os.Parcel.createException(Parcel.java:1950)
at
android.os.Parcel.readException(Parcel.java:1918)
at
android.os.Parcel.readException(Parcel.java:1868)
at
android.app.job.IJobCallback$Stub$Proxy.dequeueWork(IJobCallback.java:195)
at
android.app.job.JobParameters.dequeueWork(JobParameters.java:243)
at
androidx.core.app.JobIntentService$JobServiceEngineImpl.dequeueWork(:4)
at
androidx.core.app.JobIntentService.dequeueWork(:2)
at
androidx.core.app.JobIntentService$CommandProcessor.doInBackground(:2)
at
androidx.core.app.JobIntentService$CommandProcessor.doInBackground(:1)
at
android.os.AsyncTask$2.call(AsyncTask.java:333)
at
java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at
java.lang.Thread.run(Thread.java:798)
Caused by: android.os.RemoteException: Remote stack trace:
at
com.android.server.job.JobServiceContext.assertCallerLocked(JobServiceContext.java:481)
at
com.android.server.job.JobServiceContext.doDequeueWork(JobServiceContext.java:359)
at
com.android.server.job.JobServiceContext$JobCallback.dequeueWork(JobServiceContext.java:160)
at
android.app.job.IJobCallback$Stub.onTransact(IJobCallback.java:83)
at
android.os.Binder.execTransact(Binder.java:746)

my application force stop after i build even have no any errors, Build Successful but after that, my app crashed

I running my react native application with react-native run-android. nothing wrong here, i already got message BUILD SUCCESSFUL. but after that, my application failed open and instantly force stop. and when i try to reopen app, it's keeps failed to open.
i've tried to see logcat by running on Android Studio, and so i can see logcat why it's happen in my project.
and this is the logcat after my app crashed
--------- beginning of crash
2019-04-04 14:27:12.120 9507-9507/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.timahfrontend, PID: 9507
java.lang.NoSuchMethodError: No static method com_google_firebase_components_ComponentRuntime$$Lambda$1_lambda$new$0(Lcom/google/firebase/components/ComponentRuntime;Lcom/google/firebase/components/Component;)Ljava/lang/Object; in class Lcom/google/firebase/components/ComponentRuntime; or its super classes (declaration of 'com.google.firebase.components.ComponentRuntime' appears in /data/app/com.timahfrontend-1/base.apk)
at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(com.google.firebase:firebase-common##16.1.0)
at com.google.firebase.components.Lazy.get(com.google.firebase:firebase-common##16.1.0:53)
at com.google.firebase.components.AbstractComponentContainer.get(com.google.firebase:firebase-common##16.1.0:27)
at com.google.firebase.components.ComponentRuntime.get(com.google.firebase:firebase-common##16.1.0:36)
at com.google.firebase.FirebaseApp.<init>(com.google.firebase:firebase-common##16.1.0:554)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common##16.1.0:365)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common##16.1.0:332)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common##16.1.0:316)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common##16.1.0:53)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1759)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1734)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common##16.1.0:47)
at android.app.ActivityThread.installProvider(ActivityThread.java:6420)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6012)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5951)
at android.app.ActivityThread.-wrap3(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1710)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
i expect the application running properly, how to solve this. in my case its look like the problem is from firebase. but i don't know how to solve it. but now the actual process is i running react-native run-android then build successful, but with instantly my app stop, and even i try to open again. its keeps stopping

OutOfMemoryError in com.google.android

Can anybody help me with exception in my Android app. I use Google Analytics and have exception:
java.lang.OutOfMemoryError at com.google.android.d.d.g.a(SourceFile:51) at com.google.android.d.c.k.b(SourceFile:432) at com.google.android.d.c.c.a(SourceFile:241) at com.google.android.d.c.a.f.b(SourceFile:311) at com.google.android.d.c.a.f.a(SourceFile:108) at com.google.android.d.c.h.c(SourceFile:615) at com.google.android.d.d.s.run(SourceFile:242) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422) at java.util.concurrent.FutureTask.run(FutureTask.java:237) 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:841)
I'm using google analytics and google interstitial and bottom banner ads version 8.1.0 in my android app.
Your application uses too much memory - that's the basic explanation. There can be many reasons for that, but in general all of them are just memory leaks or (more frequently) long living objects. Use memory analyzer in Android Studio to get more information about places where problem starts. you should also read this Google's article: http://developer.android.com/tools/debugging/debugging-memory.html

I've problems with "sinch app to app messaging" on my phone

I wanna implement sinch app to app instant messaging funcitionality to my existing app. I followed github and tutorials I added sdks to my library. I can run my app on emulator. I can login and sign up and send messaging to another account which I also created on emulator. But when I try to run my app on real phone, i've faced with problems. When I click the login and sign up button, my app has stopped. After I rerun my project on emulator, I realized that I was able to sign up on my phone. When I enter my app again, it has crushed. Briefly, my app works on emulator but not on real phone now. I need your help, please help me!!
Below is my logcat.
09-24 17:06:16.991 17061-17061/com.meliksah.cakir.buec E/art﹕ dlopen("/data/app/com.meliksah.cakir.buec-1/lib/arm/libsinch-android-rtc.so", RTLD_LAZY) failed: dlopen failed: "/data/app/com.meliksah.cakir.buec-1/lib/arm/libsinch-android-rtc.so" is too small to be an ELF executable: only found 0 bytes
09-24 17:06:16.991 17061-17061/com.meliksah.cakir.buec D/AndroidRuntime﹕ Shutting down VM
09-24 17:06:16.991 17061-17061/com.meliksah.cakir.buec E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.meliksah.cakir.buec, PID: 17061
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.meliksah.cakir.buec-1/lib/arm/libsinch-android-rtc.so" is too small to be an ELF executable: only found 0 bytes
at java.lang.Runtime.loadLibrary(Runtime.java:371)
at java.lang.System.loadLibrary(System.java:989)
at com.sinch.android.rtc.internal.client.DefaultSinchClient.<clinit>(DefaultSinchClient.java:72)
at com.sinch.android.rtc.internal.client.InternalSinchClientFactory.createSinchClient(InternalSinchClientFactory.java:17)
at com.sinch.android.rtc.DefaultSinchClientBuilder.build(DefaultSinchClientBuilder.java:95)
at com.meliksah.cakir.buec.MessageService.startSinchClient(MessageService.java:48)
at com.meliksah.cakir.buec.MessageService.onStartCommand(MessageService.java:39)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3307)
at android.app.ActivityThread.access$2200(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1546)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
This error:
dlopen failed: "/data/app/com.meliksah.cakir.buec-1/lib/arm/libsinch-android-rtc.so" \
is too small to be an ELF executable: only found 0 bytes
means that you have a zero-length file with above path.
Either you made a mistake while copying it to your phone, or something truncates it after it's copied. Fixing that problem is almost definitely the required first step in getting your application working.

App force closes with java.lang.NoClassDefFoundError: android/os/AsyncTask

We recently introduced OAuth login in our app. This means using a WebView to authenticate the user, and an AsyncTask to do necessary REST calls afterwards.
Unfortunately, after introducing this login method, we're getting reports of the app force closing. This seems to be related to other AsyncTasks that are executed after the login, but the stack traces does unfortunately not tell us much:
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3100)
at android.view.View.performClick(View.java:3627)
at android.view.View$PerformClick.run(View.java:14329)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4511)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3095)
... 11 more
Caused by: java.lang.NoClassDefFoundError: android/os/AsyncTask
at com.foo.bar.TransmissionActivity.transmit(TransmissionActivity.java:44)
... 14 more
We managed to fix the error above by using RoboAsyncTask (from RoboGuice), instead of AsyncTask from the Android SDK, but we have other activities that use WebViews. WebView apparently uses AsyncTask somewhere in its call stack, and errors similar the one shown above (Caused by: java.lang.NoClassDefFoundError: android/os/AsyncTask) have started to show in our error logs.
The error happens on different devices, and different Android versions, with no apparent pattern. We have tried to reproduce the error ourselves, without any luck.
Any ideas?
It might be an issue with the build setup. (Build order of src/gen has been known to cause some issues, the libs folder for the compat library being called lib has caused some issues for me on new sdk versions).
To see if it is create a new project (in eclipse, since that's 100% android official). Add a webview and an asynctask and then do a diff on the project with your project. Ignoring src/gen/res. Hopefully you'll find that the src/gen are built in the wrong order or something like that.
~ Anders

Categories

Resources