Android Studio: “Execution failed for task ':app:mergeDebugResources'” if project is created on drive C:

This is caused by the path length restriction. I think it's 256 characters maximum.

Relocate your project and the build will succeed.


I had the same problem. Try to go to Build - Rebuild project. I didn't get that problem again and my app successfully started.


For developers who live in Iran, Just rebuild while offline. You're done! (it's related to sanctions!)


I have a similar problem with Error:Execution failed for task ':app:mergeDebugResources. And at last I found the reason is the pictures resource error which use the incorrect ".9.png".