Search code examples
linuxgradlentfsandroid-studio-2.2

Linux - Gradle can't delete temporary files and build fails


When I execute $ gradle :android:clean or $ gradle :android:assembleDebug I get

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':android:mergeDebugResources'.
> Error: Could not delete path '/media/naxa/<NTFS Partition>/<Project Path>/android/build/intermediates/incremental/mergeDebugResources/merged.dir/values-sk'.

I'd like to mention that the project is on an NTFS partition.

I found a workaround, I'm using --continue option to ignore build failures. But I want to know why the file can't be removed. Is it blocked by anything?


Solution

  • It's a known issue which has been fixed in Studio 2.2 preview 3. You can find more info in this thread.


    If you are on Windows and you see the issue, follow Comment #64:

    there is a tool you can use to get a stacktrace of the code that opened the file which is still hold by the process. This is the tool I used to generate the stack trace that was partially fixed.

    http://file-leak-detector.kohsuke.org/

    you need to run studio with the java agent.


    If you are on Linux and you are using NTFS, uncomment the following property in bin/idea.properties :

    #---------------------------------------------------------------------
    # IDEA can copy library .jar files to prevent their locking.
    # By default this behavior is enabled on Windows and disabled on other platforms.
    # Uncomment this property to override.
    #---------------------------------------------------------------------
    # idea.jars.nocopy=false
    

    If any of you continue to see this issue using 2.2 Beta or later, please file a new bug.