There may be cases where in you might see the following error when you try to sync the android project or even use command line Gradle command to build the project:

Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

The solutions to the above issue include the following:

  1. Disable daemon support to file
  2. Set configure on demand to false
  3.  Increase the memory pool size allocation
    org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError

If however, you face the same issue, and you try all the solutions possible on StackOverflow, including invalidate cache and restart, then check the modules added to the current project. It could be possible that the module name you specify does not match the actual module name.

Hope that helps!