Android simulation app kills command due to low memory

Source: Internet
Author: User

Android development, sometimes we need to test the background process is killed, and then re-enter the app to restore the scene case. If the way to fill the memory is more troublesome, here are a few quick simulations of how the background process was killed:

Mode 1:

The easiest way to do this is to click "Stop porcess" in Ddms to Kill your program, which you can do when you debug the program.

Mode 2:

Suitable for debug programs
Open Android Monitor in Android Studio, select the process, press the app to back to the background, click the Terminate Application button

Mode 3:

The ADB shell am force-stop package-name app is forcibly closed in the foreground, forcing the specified package pack app to stop.

ADB shell AM kill Package-name app has been stuck in the background using the home key, killing the specified package app process, which kills processes in safe mode without impacting the user experience. Parameter options:--user <USER_ID> | All | Current: Specifies that the user process kills if the default is not specified for all users. (about user_id will be introduced below)
ADB shell am Kill-all app through the home button has been stuck in the background use, kill all background programs, need to first the target program to enter the background, and then open a other program

Mode 4:

For All Programs
Open Mobile Developer Options-Background process restrictions-do not allow background processes, also press the home key back to the background, open another app and then quit, the process was killed.

Mode 5:

Via simulator or a root-based real machine:
1. Press the home button to exit your program;
2. In the console, enter the following command (Windows system WIN + R-cmd)

Find the app's process ID adb shell PS
Find your app's package name
MAC/UNIX:ADB Shell PS | grep your.app.package
After following the above command, it looks like this:
USER PID PPID vsize RSS wchan PC NAME # u0_a198 21997, 827940 22064 ffffffff 00000000 S your.app.package
Kill your app with the PID kill-9 the ADB shell 21997

Android simulation app kills command due to low memory

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.