naXa naXa - 1 year ago 103
Linux Question

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

When I execute

$ gradle :android:clean
$ 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 found a workaround, I'm using
option to ignore build failures. But I want to know why the file can't be removed. Is it blocked by anything?

Answer Source

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.

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 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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download