Search code examples
androidandroid-lifecycleandroid-memoryandroid-studio-4.0

How to simulate Android killing app caused by low memory in AndroidStudio 4


Previously, when you launched an app from AndroidStudio, you can simulate that Android has killed the app because of low memory doing this:

1. Press home button
2. Terminate the app pressing terminate button in logcat with your process selected
3. Reopen your app pressing in their icon in the emulator

Since Android Studio something has changed because terminate button in logcat is completly closing the app, and not simply killing the process in the same way the OS whould do when is low of memory


Solution

  • I found the way:

    Since AndroidStudio 4, if you run the app from AndroidStudio play button, logcat terminate button will simulate a complete stop of the app, instead of a low memory kill.

    The solution is launching the app from the icon in the emulator, them that terminate button will simulate the low memory kill correctly.