Execution failed for task ':mergeF0DebugResources' Failed to crunch file png Windows


#1

I get the build error :mergeF0DebugResources along with the message Failed to crunch file. The cause for this error seems to be that the path name is too long. Moving the project directory to a root level folder ex: C:/myProject/ seems to fix the issue.

1>Error: Failed to crunch file C:\Users\edcha\Documents\Visual Studio 2017\Projects\TabNavigation1\TabNavigation1\platforms\android\build\intermediates\exploded-aar\com.android.support\appcompat-v7\26.0.0-alpha1\res\drawable-hdpi-v4\abc_textfield_search_default_mtrl_alpha.9.png into C:\Users\edcha\Documents\Visual Studio 2017\Projects\TabNavigation1\TabNavigation1\platforms\android\build\intermediates\res\merged\F0\debug\drawable-hdpi-v4\abc_textfield_search_default_mtrl_alpha.9.png
1>:mergeF0DebugResources
1>FAILED
1>FAILURE: Build failed with an exception.
1>* What went wrong:
1>Execution failed for task ‘:mergeF0DebugResources’.
1>> Error: Failed to crunch file C:\Users\edcha\Documents\Visual Studio 2017\Projects\TabNavigation1\TabNavigation1\platforms\android\build\intermediates\exploded-aar\com.android.support\appcompat-v7\26.0.0-alpha1\res\drawable-hdpi-v4\abc_textfield_search_default_mtrl_alpha.9.png into C:\Users\edcha\Documents\Visual Studio 2017\Projects\TabNavigation1\TabNavigation1\platforms\android\build\intermediates\res\merged\F0\debug\drawable-hdpi-v4\abc_textfield_search_default_mtrl_alpha.9.png
1>* Try:
1>Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
1>BUILD FAILED


#2

That is expected, Windows has a 255-character file path length limitation.

There are no workarounds or solutions that I know of. Just stick to using flatter dir structures.


#3

Yes. I’m posting this here because the error message is a bit generic. Hopefully this will help others find the solution more quickly.