Android Studio: Gradle sync failed

今天Android Studio打开报了这个错误:

这个时候Android项目无法编译,并且安卓模拟器在启动的时候会闪退

Emulator: Process finished with exit code 0

具体错误如下:

Gradle sync failed: Unable to start the daemon process.
		This problem might be caused by incorrect configuration of the daemon.
		For example, an unrecognized jvm option is used.
		Please refer to the user guide chapter on the daemon at https://docs.gradle.org/4.1/userguide/gradle_daemon.html
		Please read the following process output to find out more:
		-----------------------
		CodeCache: size=245760Kb used=2467Kb max_used=2478Kb free=243293Kb
		bounds [0x0000000004890000, 0x0000000004b00000, 0x0000000013890000]
		total_blobs=854 nmethods=560 adapters=206
		compilation: disabled (not enough contiguous free space left)
		FAILURE: Build failed with an exception.
		* What went wrong:
		java.lang.OutOfMemoryError (no error message)
		* Try:
		Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
		* Get more help at https://help.gradle.org
		OpenJDK 64-Bit Server VM warning: CodeCache is full. Compiler has been disabled.
		OpenJDK 64-Bit Serv... (show balloon)

解决方法:

在任务管理器中找到这个进程,结束它即可

导致这个问题的具体原因不清楚,但是这个进程总是会经常的出问题,结束了它(也就是重新启动这个进程)之后电脑又会恢复正常,目前据网络上说是个系统的Bug