Why does Android restart apps? - android

Recently my Android TV app has started to restart itself about every an hour. The min SDK version is 27 and the tv is Sony Bravia.
So when the exoplayer (r2.15.0) in my app is playing HLS in full screen, the app might throw users back to the main screen of my app. The main screen is a few Activities away from the video screen.
I have tried adb but every time this happens, the Android studio only shows the adb disconnects. There hasn’t been any logs that I can look at.
But if I just let the app run videos in the emulator on my computer, it is fine.
Any people have any ideas?

Usually due to memory issues (memory leaks eating up all the memory). Another would be a setting where you can set it so the OS closes background apps and reopens them when being active.

Related

Flutter app startup time slow if downloaded from PlayStore but instantaneous if installed via USB

My app entered the internal testing stage, meaning I upload it to Google Play Store as AAB bundle and then can install it on various devices.
I have noticed that the startup time of the app downloaded from the store is atrociously slow. The splash screen is hanging on for 10 - 15 seconds depending on the device.
On the other hand, if I install the very same app via USB from the dev machine it starts up instantaneously, with the splash screen visible for maximum 1 - 2 seconds.
Also, it looks like it is only the startup time that differs significantly. Regarding the overall performance of the app it is indistinguishable for the version installed via the USB cable and the one downloaded from the store.
I have absolutely no clue why this may be happening and will appreciate any suggestions pointing to what may be causing such behaviour.

Custom apps wont turn on after reboot

I have written some basic apps for both iOS (using Swift) and android (using Xamarin). I am often bugged by a problem on both platforms: When I try to run my app from the device (that my IDE installed for me on the device) after a while, it just wont turn on (usually crashes without an error message within the first second of loading). Everything is always fine upon recompiling. With android, this happens usually whenever I haven't recompiled since last reboot. With iOS, it seems pretty independent on reboots, but usually happens within hours, sometimes days.
Why is that? Is there any way to prevent this (Preferably one that wouldn't drastically increase installing time, like posting my app on store or at least creating an installation package and installing it manually)?

Android studio: Android device freezes after crash

New at Android. I am testing my app via Android Studio, running, not debugging. My device is a Samsung S2, API level 16.
Almost every exception freezes the device and requires restart or even battery remove&insert. Any solution to this?
UPDATE:
This seems not to be code related and happens on different projects. Any NullPointerException for instance would cause the device's screen to turn black. Sometimes the device will restart itself, other times I would have to remove the battery and re-insert it.

Is my PC fault, or android emulator is slow

I'm on the learning stage of android and I have to run/debug my application in emulator very often. The thing is that between I press the debug button and until the application gets started on the emulator I have to wait 1-2 minutes.
Is this normal? My PC is a i5 with 8GB RAM.
The emulator is certainly not fast, but one thing you should do is to make sure you don't close the emulator. Leave it running, and then most of the initial startup time will be taken care of. The emulator is a real emulator (unlike the iOS simulator). Think of the startup time of the emulator as booting up your phone. You're not going to turn off and turn on your phone every time you want to use an app, so similarly with the emulator, just leave it on.
It’s not normal, but it’s as expected. The Android emulator continues to be very slow and basically unusable for development. You’re better off developing on a real device. (Deployment to real device is much faster with Android IDE than it is on Xcode/iOS.)
Google has stated that it is a known issue, but it’s not known if/when it actually will get fixed.
I have experienced startup times of 5-10 minutes for the emulator to start up. The startup time to start debugging your application is going to depend on the size of your application. It has to tranfser the .apk over each time you want to debug. If your application is full of large files this can be a long time. One time I put a video in my res/raw folder and it brought my application to 25 mb. This ended up taking around 5 minutes to start debugging.

Reasons why my Android App would crash on my phone consistently, but not on my emulator

I have an app that uses quite a few graphics in it.
When I open and close my app repeatedly on my emulator (1.5 - 2.2) it runs fine and by checking the heap I can see everything is being cleaned and gc'd properly.
However, when I run my app on an HTC Aria phone (2.1) the app crashes every time I try to re-open it. When I look at the heap I can see that objects are NOT being cleaned up like they are in the emulator.
Does anyone know why this behavior could be happening? I did try it on another HTC Aria (a friends) and it crashed the same way as on my phone so I think it's not just isolated to my particular phone.
Any thoughts or ideas would be really appreciated on why things are cleaning up properly on the emulator, but not on my phone. One thing to note, is that I DID have it working and gc'ing fine on my phone a few days ago and I didn't change much and now it's not working on my phone so it's a bit of a mystery to me.
Thanks!
Note:
The crash is caused by an OutOfMemory Exception. I'm pre-loading a handful of graphics, and there's not enough memory for two instances of the application to be running at the same time so it's crashing because the 1st instance of the application was not cleaned up properly.
You have several emulators, all running just this app, closing it and start it again.
Your Android device has several processes running the same time, like background sync, Facebook notification, Twitter notification, Calendar sync, Contacts sync and the like.
One way to look at this is to try to mimic your Android device state on your different emulators, and see if you can get the same error on the emulators. Use some apps that sync in the background and others who use a lot of memory. Then you have a testing environment that mimics the real world, and you can change your app up to a state where it doesn't crash. Maybe downsize the images as much as you can to ease memory usage.
Remember, you can never force the Garbace Collector to start. You can only tell the system that it is possible to collect this garbage.

Categories

Resources