Logcat full of "Wtf, activity ActivityRecord" entries - android

I am getting thousands of the following warning message in my logcat, and it's crowding out the messages that I'm actually looking for:
W/ActivityManager﹕ Wtf, activity ActivityRecord{4338cd90 u0 us.bridgeses.Minder.debug/us.bridgeses.Minder.MainListActivity t269 f} in proc activity list not using proc ProcessRecord{4289a348 4821:us.bridgeses.Minder.debug/u0a246}?!?
Possibly related, my phone is now occassionally popping up the "Waiting for debugger process" dialog even when my phone is unplugged and the app is in the background. It only stops if I uninstall it, and starts up again the next time I debug. Any ideas?
Edit:
I just commented out my entire MainListActivity class. My app is now literally doing nothing except creating an empty Activity. I'm still getting tons of this message, and I'm still getting this message.
Edit 2:
This is getting really weird. I uninstalled the debug app, did not reinstall it, and I'm still getting this message.

This message comes from the Android OS. It happens when your activity is not destroyed correctly. Therefore the ActivityRecord is still there, but the corresponding proc is not. By rebooting, all records will lost, so you would not see any of these errors.
Typically this happens when a active/foreground activity component is being disabled. Such as calling packageManager.setComponentEnabledSetting() method to disable current active activity component.

I restarted my phone and the error has not recurred for 10 minutes. It's not really an answer, but I guess it's a resolution.

Related

How can I find what is stopping my activity

I have a single activity with a couple of fragments that is being stopped randomly and I'm trying to figure out the cause. Similar issue to this (Why is my android activity being stopped?) but unrelated answer.
The activity is running on Android Wear, with accelerometer data being collected. It only stops if I also interact with the device while moving it, like tapping the screen. I've tried:
Disabling orientation changes in case shaking the device causes config changes.
Disabling swipeToDismisson the Wear activity in case a tap was misinterpreted as a fast swipe to close.
Overriding onLowMemory() with breakpoints to check if it is a resource issue.
Overriding onFinish() with breakpoints in case of an unintentionall call to finish()
The activity is started from a service with
Intent startIntent = new Intent( this, WearActivity.class );
startIntent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
startActivity( startIntent );
with the activity set to android:launchMode="singleTask", but there is only one start request.
I've run out of ideas. Is there any way to determine who is sending the stop message? Below is a complete stack trace, the activity is stopped by receiving the STOP_ACTIVITY_HIDE system message in ActivityThread.handleMessage():
at myRandomApp.WearActivity.onStop(WearActivity.java:76)
at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1212)
at android.app.Activity.performStop(Activity.java:5387)
at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3196)
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3245)
at android.app.ActivityThread.access$1100(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1236)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5026)
at java.lang.reflect.Method.invokeNative(Method.java:-1)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(NativeStart.java:-1)
EDIT:
In response to some comments, the above stack trace was not generated by an exception being thrown. It is just where I hit a breakpoint to see the history of calls leading up to the app being stopped. The app exits cleanly, I'm trying to figure out why it wants to quit at all.
UPDATE:
I've finally found the culprit. Invariably, before my app shuts down, I get this a few moments earlier in the log output:
I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.google.android.wearable.app/com.google.android.clockwork.home.HomeActivity (has extras)}
It appears moving the watch about increases the pedometer step count, which causes a new info card to be shown on the home screen of the watch. This card interrupts my full screen activity and closes it. Does anyone know of a way to prevent that? It feels like a Wear bug, I'm not sure other apps should be able to interrupt a running foreground application like that.
I've found the reason why my app shuts down, but only due to a lucky bit of info sent to the log. I'm still looking for an answer to my original question, for a general way to determine the reason for the Android system stopping apps. Maybe that is just not possible?
I don't have an answer for my original question, but I have a workaround for the symptoms caused by it. Rather than starting my app as a full screen activity, I instead create a notification in the context stream with an action to go fullscreen. The notification is persistent, so even when other cards enter the stream, they don't cause my task to quit.
Iv'e filed a bug for this issue at https://code.google.com/p/android/issues/detail?id=75918&thanks=75918&ts=1410235765
The original question remains open, but I suspect it has no answer...

Remove the Unfortunately the app has stopped message in android(Not its cause, but message itself)

Is there any way I can get rid of this message despite the app being stopped due to any exception?
My app(background service) is designed in such a way that it always restarts itself within 1 mins in case it gets killed. So even if it gets stopped, it would be restarted again, with no negative impact. Hence that message would unnecessarily annoy/worry the users.
As the app works fine on my device, but on other's device, its giving that message once or twice a day. I have no way to read the logs and check whats going on. I have placed the try/catch block everywhere. And the code is too complex to dig into again and check whats wrong. In short, I don't want to get rid of the "cause" off the message. But the "message" itself. Is it at all possible?
So How do I get rid of android OS showing that message even if it has "stopped"?
So even if it gets stopped, it would be restarted again, with no negative impact
There is no way to know whether or not there is a "negative impact" until the source of the problem is found.
I have no way to read the logs and check whats going on. I
Use crash logging frameworks like ACRA to collect stack traces from production apps.
And the code is too complex to dig into again and check whats wrong.
Use the crash logs from crash logging frameworks like ACRA to identify the source of the problem.
Is it at all possible?
Read the documentation for your chosen crash logging framework and see what the options are for user notification regarding such crashes. Some, like ACRA, will offer a "silent" mode where the crash is logged but without informing the users of that crash.
Theoretically, you could set up your own Thread.setDefaultUncaughtExceptionHandler

Calling a method in the system process without a qualified user error

I'm using the notification listener service in android 4.4 and I'm coming across an error that causes my app to stop getting notifications posted.
It's fairly random, but when it happens I'm seeing:
12-31 01:40:44.080 21680-21680/? W/ContextImpl﹕ Calling a method in the system process without a qualified user:
android.app.ContextImpl.sendOrderedBroadcast:1192
android.app.ContextImpl.sendOrderedBroadcast:1183
android.content.ContextWrapper.sendOrderedBroadcast:390
com.android.settings.applications.ProcessStatsDetail.checkForceStop:314
com.android.settings.applications.ProcessStatsDetail.onResume:108
in the logs.
I can even recreate this by just entering the "process stats" section of the developer tools on the phone. As soon as I select an app that uses the notification listener the puts up this warning and unbinds and destroys the service and when it recreates is it doesn't always pick up on events again.
I'm not sure why this would happen, can anyone shed any light?
1) the NotificationListenerService is started by the system and the code for sendOrderedBroadcast throws a warning if it was called by the system process (here)
2) That is just a warning though. There is probably a crash somewhere else in your code. When a NotificationListenerService crashes, Android doesn't restart it unless you toggle the permission or restart your phone. Look for another crash and try either of those methods to restart it if it has. Starting it yourself will not work.
Check your AIDL Package name, for me the Package name in client and server were mismatched. Hope it help somebody

Logcat messages disappear after a short time

Sometimes eclipse logcat messages disappear after closing the app for a short time. (Mostly not so short.) How to make it never disappear automatically?
EDIT: My device is still attached. And how to set it to show log even after device disattach and clear just before next launch?
this is also happening with me. The device is attached. And so all the internal actions are getting logged and the error message disappears very quickly. You should try the following (it worked for me)
Restart Eclipse (as stated here Why logcat is not showing anything?)
if 1 does not work, you may try to increase the logcat message size. From Window > Preferences > Android > LogCat (increase size to more than 5000)
First one worked for me. In this way also you need not to detach the device everytime you deploy the app from eclipse. Regarding, the other question - you can always clear the existing log from [Clear log] button.

Application throws an error after relaunch

My application throws an error when I attempt to start it from "Recent applications". Problems :
Error appears only if application was inactive (stopped) for a long time (approximately one hour). I can't catch this error by myself - when I'm killing process by myself and then relaunched it there is no errors!
I can't see Exception log in debugger, since it's disconnects after so long time.
How can I catch such kind of errors in debugger? Looks error appears only when OS kills application by itself.
EDIT
I didn't overrided onResume method. Just onStart, and there is nothing special except instantination of my SQLiteOpenHelper.
even if your app is in paused/stopped state, log cat will still be working as long as device is connected. make sure you selected all logs options in windows > devices > all logs instead of windows > devices > com.your.project .
so when you will try to relaunch crash must be recorded in logCat
if still have any issue, install logcat app from market and refer it for logs.
Sounds like there might be an issue in your
OnResume
call. What is your application doing? Is it using a location manager? Does it have services or threads that need to be restarted? More infomation please.
Look through the Android application lifecycle chart:
http://developer.android.com/reference/android/app/Activity.html
It should help you understand what's going on. If all else fails, add a lot of logging to logcat and see what the output looks like on your end. As long as you don't unplug the device, you shouldn't lose that in Eclipse. If you do, you can always run "adb logcat" from the command line or shell to see exactly what's happening.

Categories

Resources