When I start app (First launch or Launching after killing it through task stack), It takes around 5-6 seconds to come to Launcher screen and shows white screen.
When I made launcher activity translucent then still same app lag time is there.
One more thing is that if I play with application for some time like 30 min and kill it through task stack then it take much more time like 15-20 seconds to launch.
I have read all blogs and answers on stack-over flow but it did not help.
Some information regarding above scenario:
When app takes more than 10 seconds then I observed that it does verification of objects as it show in logs.
I have instance and variable in Application class to use it throughout app.
I have GCM also in app.
Thanks for the suggestions. It worked for me by disabling Instant Run.
I checked on this link Android Studio 2.0 - pause/white screen on App first run
Related
I had a problem running my app on Nexus 6p: My Android app is getting killed every time my app is moving to background.
I have already set this app to be 'Not Optimized' and made reboot - but still had no success. I see that my Activity's onDestroy() is called for every time..
Any idea?
I don't think there is any way or reason to run app in background. This link shows how to run tasks in background. If your use case doesn't fit in scenarios described there, please provide it in problem.
I have crashes occurring in my app when the drops in the LRU-application list within androids OS (See http://developer.android.com/guide/components/processes-and-threads.html#Lifecycle). This is due savedInstanceStates not being handled properly. It's really painful and time consuming to constantly have to open my app and then open like ten other applications just to mimic these errors and verify my fixes.
Is there a quick way to mimic this via code?
The way I test those cases is go to Settings > Developer Options. Scroll to the very bottom and enable Don't keep activities. Also, set the Background process limit to No background processes.
Open your app and hit the home button once you are in the activity you want to test and then bring it back from the Recent Apps list.
Hope this helps.
I'm currently having an issue with certain Samsung devices where starting an activity with an intro animation sometimes causes the whole device to crash.
The app essentially transitions from an Activity with a VideoView to another activity with a VideoView. The video of the activity that just started stutters in a loop for about 10 seconds before the whole device crashes and restarts.
It's not crashing the device all the time, but is limited to a couple Samsung devices from what I've tested.
I've looked at crash logs of the device which currently seem to be inconclusive from what I can see.
Important but relevant note, I am finishing the activity once starting the next.
You could try to attach the debugger manually through Android Studio if your process is alive long enough after the boot sequence.
Source:
https://developer.android.com/studio/debug/index.html
One more thing you could try is to put the 'wait for debugger' instruction in your code, using the Debug.waitForDebugger() method.
Source: https://developer.android.com/reference/android/os/Debug.html#waitForDebugger()
Other than that, you could put a lot of logs in your code, then fetch them using adb logcat > crash-log.txt command from your CMD/Terminal.
I was studying some tutorials on Android programming and I realized that pressing the Home button on the emulator takes me tot he phones Desktop, but my sample that was running at the time only goes to the background and does not get destroyed. However, if I press the return button, the app is destroyed as well. So I am assuming there might be other apps running int he background as well, those which I am not aware of. Is there something in the android emulator resembling the task manager from windows, which shows what apps are currently running on the phone? I don't have a smartphone with me, but I remember seeing something like that on my friend's smartphone a few days ago. It wasn't an external app but was something built into the phone, I could access it by going to Settings or something.
Is there a task manager built into the android emulator, or is there any other way I can see such things through the SDK debugger?
Inside the settings, there is a list of currently running processes.
First , Leaving the activity does not mean the process ends, It is just not invisible . When the Os needs more memory ,it will be recovered.
If you want to have a backup process, you can start a back service.
http://developer.android.com/reference/android/app/Service.html
Here is how I end a process (only works on Android 4.0+).
Instead of pressing home, press recent and swipe away the process you want to end. Then press home (or back).
You can also use this to close those nasty apps that prevent you from closing them by not allowing back button to work on their main screens.
This is much quicker than having to go to settings, etc.
We have designed an hybrid app which is a bit heavy (9 MB). Problem is that at times, minimizing this app (home button) makes the app reset in background i.e. its app cache is lost and app reloads from splash screen. After minimizing we worked with other apps in tablet (Galaxy 800).
We saw this problem only if we tried to launch app from the icon in launcher. This problem did not happen when we tried to launch it from the minimized list(recent apps button).
This problem is not specific to the tab. It also happened in Galaxy 3 and Droid Razr also.
Any guidance?
Problem is that at times, minimizing this app (home button) makes the app reset in background i.e. its app cache is lost and app reloads from splash screen.
This is perfectly normal.
Computers, phones, and tablets do not have infinite RAM. Android's approach to this problem is to keep your process around for a while after the user has left it, but eventually Android will terminate your process to free up RAM for other applications and their processes. You can read more about the Android process model in the documentation.
It can be possible that ‘deep clean' option is enabled by mistake on your phone. What deep clean does is, whenever you minimize an app , it releases all the memory associated with that app, and hence when you again open that app, it will start as if it is new. To check the 'deep clean' option,
go to the
Developer options -> 'Don't keep activities' -> disable it
If it is not disable please disable it.