简体   繁体   中英

OpenJDK continues running after closing Android emulator

Problem

I am using VS Code to edit and run Android projects. The emulator will open and I see the program OpenJDK Platform binary start, followed by the program compiling and running. However, after closing the Android emulator and VS Code, OpenJDK continues to run.

任务管理器截图 (Task manager after closing Emulator/VSC)


Solution?

Is this normal behavior? Is there a way to have OpenJDK JRE shut down after the emulator/VSC exits?

My main concern is battery life as I am using a laptop.


Extra Information

System: Windows 10 Pro (1909)
Visual Studio Code version: 1.42.0

Notes

  • I am using the Flutter framework for Android development
  • Intel Optane memory is enabled
  • The emulator & JRE being used are from the Android Studio bundle

1* open the task manager, and locate the process ID

2*

TASKKILL /PID %PID%

The JVM Process Status Tool helped me identify why OpenJDK was not closing. Running [path_to_jre]/bin/jps -l in terminal spat out the following:

2272 org.gradle.launcher.daemon.bootstrap.GradleDaemon
4500 sun.tools.jps.Jps

The solution I landed on is to create a task in VSCode:

...
    {
      "label": "gradle --stop",
      "type": "shell",
      "command": "C:\\Gradle\\gradle-6.1.1\\bin\\gradle --stop",
      "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": false,
        "panel": "shared",
        "showReuseMessage": true,
        "clear": false
      },
      "problemMatcher": []
    },
...

This results in the OpenJDK process ending.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM