Native not recompiling when header changes gradle 2.8

See for source code that demonstrates the problem.

If after a successful native build, a header file is modified, and the project is rebuilt again then the C++ file that uses the modified header file is not compiled until gradle clean is called.


Is your example missing files? I only see a README.

I added the files. Sorry about that. Trouble with using “svn commit” all the time and then switching to “git commit”, I keep forgetting to push.

Awesome, thanks @marcpawl.

This is a problem with older builds too, I tried 2.7, 2.8 and 2.9-rc-1.

I raised GRADLE-3357, which will be fixed in 2.10. We’ve revamped how we track source dependencies in native code in master.

The workaround is to add ‘src’ as a srcDir in exportedHeaders like:

exportedHeaders {
   srcDirs "include", "src"

What’s happening is local.h is being excluded in source, which gets used as the inputs for the compile task.