Skip to content

Compose Hot Reload does not work after first reload on Winows Dev Drive with REFS file system. #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xidsyed opened this issue May 22, 2025 · 1 comment
Labels

Comments

@xidsyed
Copy link

xidsyed commented May 22, 2025

Considering I and (many other devs) use Windows Dev Drive to get decent build times on windows. It was quite confusing initially when i tried changing the source code and only the first change would be reflected and then the following error would show up in the dev console :

Compiler | BUILD SUCCESSFUL in 25sCompiler | 11 actionable tasks: 1 executed, 10 up-to-dateCompiler | Gradle was unable to watch the file system for changesCompiler | net.rubygrapefruit.platform.NativeException: Couldn't add watch, error = 1: D:\AndroidStudioProjects\NewzleCompiler | 	at net.rubygrapefruit.platform.internal.jni.AbstractNativeFileEventFunctions$NativeFileWatcher.startWatching0(Native Method)Compiler | 	at net.rubygrapefruit.platform.internal.jni.AbstractNativeFileEventFunctions$NativeFileWatcher.doStartWatching(AbstractNativeFileEventFunctions.java:49)Compiler | 	at net.rubygrapefruit.platform.internal.jni.AbstractFileEventFunctions$AbstractFileWatcher.startWatching(AbstractFileEventFunctions.java:181)Compiler | 	at net.rubygrapefruit.platform.internal.jni.WindowsFileEventFunctions$WindowsFileWatcher.startWatching(WindowsFileEventFunctions.java:59)Compiler | 	at org.gradle.internal.watch.registry.impl.HierarchicalFileWatch
...
Compiler | Exiting continuous build as Gradle does not watch any file system locations.

Turns out, Dev Drive is not supported by the Gradle File Watcher:

Network file systems like Samba and NFS are not supported. Microsoft Dev Drives (ReFS) are also not supported.

Unsupported File Systems
When enabled by default, file system watching acts conservatively when it encounters content on unsupported file systems. This can happen if you mount a project directory or subdirectory from a network drive. Gradle doesn’t retain information about unsupported file systems between builds when enabled by default. If you explicitly enable file system watching, Gradle retains information about unsupported file systems between builds.

There are two workarounds to this

  1. Move your project into an NTFS formatted drive to allow gradle file watcher to work (tested. works!)
  2. Force gradle file watcher to watch an unsopported file system by enabling the flag in your gradle.properties file (unlikely to work)

To force file system watching for all builds (unless disabled with --no-watch-fs), add the following value to gradle.properties:

org.gradle.vfs.watch=true

source

@xidsyed
Copy link
Author

xidsyed commented May 22, 2025

Accordingg to my research the first workaround is the best of both worlds. I think its best to leave the .gradle i.e. the gradle cache on the Dev Drive, since it requires reading a lot of small files etc. Which windows Dev Drive is optimized for.

The JDK and the project files can remain on the C drive. They dont make a big difference since they get loaded into the memory the very first time anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants