如何在AndroidStudio 4中模拟由内存不足引起的Android Killing应用

问题描述

以前,当您从AndroidStudio启动应用时,您可以模拟Android由于内存不足而杀死了该应用:

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

由于Android Studio发生了一些变化,因为logcat中的终止按钮完全关闭了该应用程序,而不仅仅是像内存不足时操作系统应该执行的操作一样终止进程

解决方法

我找到了方法:

AndroidStudio 4起,如果您从AndroidStudio播放按钮运行应用程序,logcat终止按钮将模拟应用程序的完全停止,而不是低内存消耗。

解决方案是从模拟器中的图标启动应用程序,它们的“终止”按钮将正确模拟低内存清除。