I am struggling with a strange situation with my Android app.
It runs on a 5.1 OS and the device is Rooted.
The app is running fine for a few days and then from an unknown reason it crashes (WIN DEATH without any exceptions from my logs).
I think it related to an internal memory leak on a specific Android model I'm using.
Anyway, I need to restart the app in cases like that.
Unfortunately, using 'Thread.setDefaultUncaughtExceptionHandler' method doesn't help because it won't handle those situations (the app is crushed).
I thought about creating a second app that samples the state of the process and if it is disappears from the process list, it starts the activity.
Is there a more elegant way to handle this situation?
Thanks a lot!
Asaf
Related
I have a Xamarin.Android app that has been in production and stable for several years, but is now exhibiting crashing, during startup, when running on a specific device type (Zebra TC21/TC26), but only after it has been unused for 3 or 4 days.
If the app is used regularly, it performs reliably, but when left idle for an extended period, it crashes, during restart, apparently because Android has recycled the Application object, perhaps as described here.
The strange thing is that neither a forced close of the app nor a reboot of the device resolves the problem. Only after uninstalling and reinstalling the app will it run again.
To make matters worse, I can't seem to get any useful log data from the app when it is running on Zebra devices. The app is extensively instrumented for logging (via Loggly) and it works reliably for all other Android device types that I have tested, but Zebra test runs yield no log events.
I apologize that this is a vague question, but I have spent a huge amount of time trying to diagnose this issue and I am at a loss for what to try next. Any suggestions would be very welcome and I am happy to post more details, if required.
UPDATE: As suggested by #Cheesebaron, I have examined the device log, retrieved from a Zebra, which shows that the crash is due to an NRE. I attribute this to a required dependency not being injected correctly, but I am not sure what that tells me about the root cause of the problem, which clearly doesn't occur during normal operation. I am not an expert in deciphering Android logs, and I am curious what I should be looking for to understand the specific OS event that tipped the app into a failing state. Just being able to reproduce the issue in real time would be a great step forward.
I am also puzzled why this issue is not cleared by restarting the device. Does this indicate a data/settings corruption or could there be some other explanation? Is there anything in the device log that I should be looking for to understand this?
I am happy to post the device logs (or excerpts) if anyone feels inclined to review them.
I am building an android bluetooth application that justs waits for bluetooth connections with some devices. The problem is that the application crashes after opening too many (10+) applications in the same device without closing them. The application works fine if I dont use the device(opening other apps).
I thought that a particular app might cause the problem, but I've checked this.
Why could this happen? Is it a memory issue?
Thanks in advance.
Are you using a service? Is your app supposed to run "all the time"?
You should probably read about activity lifecycle. Android is very strict about memory management. What happens is when there's a memory lack, Android can shutdown any activity without warning.
I have an android app installed on device (4.2.2).
The device will never go to power save mode.
If i leave the app open for more than 30 minutes, the app closes automatically.
And no exception found in the log.
Is this default android behaviour?
If possible please share any links about this issue.
That is just part of how Android manages memory for activities using the Low Memory Killer, even if as of today devices running Android have vast amounts of memory, the same rules are still applied as when it was designed, and it was designed to run on devices with low memory, if you want to keep it alive without user interaction you might have to either use a Service, or maybe find a way to simulate user interaction.
If you have this behaviour just only 4.x, but under 4.x don't, try in Manifest to turn true largeHeap. You have to turn it on in apllications tag attribute. I hope it will help.
I've confirmed this on Android 2.3.6 and 4.1.2 .. Can't say i did on iOS(Haven't had an extended test on it yet). But here's the deal:
I've got an app which sends it's current coordinates to a php service which saves it to a mysql database and sends a response(usually 1) back to the app as a result. It does this in a 5 second interval and does it in a way i want it to. So basically the app does a fine job. However; If i wait a while the complete app just CLOSES itself at random. It happened to me after 9 hours and 3 hours and there's no real reason to do so. The phone is just laying stationary on my desk basically.
Is there any known issue for titanium apps to just shut down without a crashreport/warning whatsoever?
I imagine you might be violating something about the way the mobile OS runs. Maybe you have a memory leak and the device/emulator sees your app eating all the memory and force closes it. I'm not sure what logs are available on devices to inform you about what just happened. Maybe you'll see the app was closed by the device and a reason why.
Have you profiled your app? I'm going to guess memory leak.
I have written an android app that generates a strange exception on the LG-Phone I have just started testing on. In DDMS the tag is "ISP_LOG_MW_DEBUG" and the text is "AMI_IsWindowSearch()." It is generated about 10 times per second while the app is running. It doesn't seem to interfere with the program itself, but I would rather not have this error. but I can not find any information on this on the web.
If a click the home button (the app continues running in the background) and start the app again (new UI, with the old services) the amount of these messages increases each time. So it is reasonable to assume that they are generated by something in the UI.
Has anybody experienced this error or has any idea how to avoid it?
Real devices can sometimes make a lot of noise. Sometimes the vendors just leave a lot of debugging turned on. If your app is not crashing, or showing performance issues, I would say it's safe to ignore.
Also, try with another device, or try with the emulator. If you don't see those errors with another device or the emulator, I think it's safe to say the vendor developers of the the LG device are just lazy and didn't turn off all their debugging like a good developer should. :D
db