debug build cannot access out.jar during build because it is being use by another process

429 Views Asked by At

now that I'm working from home I'm trying to work for my home desktop (windows) when I try and run a debug build. I get the error.

Execution failed for task ':app:packageDebug'.
> Exception modifying resource jar file: : D:\Dev\APPFOLDER\app\build\intermediates\merged_java_res\debug\out.jar: The process cannot access the file because it is being used by another process.

I don't understand what is going on I can run the build just fine on my laptop (Mac). I've even gone as far as to completely factory reset my computer.

3

There are 3 best solutions below

0
On

Hi @Donovan I've been facing the same issue when started updating my project from windows. Same project works fine and able to build apk in mac os.

Finally figured out the cause because of your answer. Thanks and check out below solution too.

Current System OS : Windows 10


My solution : ---Nb:Only disabling heap analytics will work. But I tried below steps with heap analytics and works for me.

  1. Updated all dependencies with latest version (only updating lib doesn't resolve the issue: but its recommended).
  2. Update 'com.heapanalytics.android' version (**very important) in project level build.gradle. In my case I updated to version '1.7.0'
  3. Update google play services version in project level build.gradle
  4. Add permisiion in manifest if not previously included. It was for firebase analytics instance.

0
On

I've not figured out how to fix this but the issue is with com.heapanalytics.android I've disabled heap for now.

0
On

This happened with me and solved it by adding this to your build.gradle if you are initialization it in the run time.

    android {
        defaultConfig {
            // Add this section to enable Heap event capture.
            ext {
              heapEnabled = true
            }
            // ...
        }
        // ...
 }