3

Error : The process cannot access the file because it is being used by another process

Details : I have just downloaded android studio 2020.3.1 Beta 1 (Arctic Fox). I have created new Android studio project for Jetpack compose. Now the scenario is, i have 1 emulator running and android studio has its built-in compose preview. Whenever i try to build app i got this error. I have tried many solutions including invalidating cache restart and few other solutions but none of them seems to be working. P.S : I have also tried by deleting build folder. This seems to be specific error in Android studio with compose addition.

I am attaching error screenshot.

Error keeps coming even after invalidating cache

Zaeem Sattar
  • 990
  • 2
  • 12
  • 30

2 Answers2

4

It's not in jetpack compose context, but works also perfectly fine: Android Studio: R.jar: The process cannot access the file because it is being used by another process

Just copy, paste the following in your Terminal:

taskkill /im java.exe /f 
3

In Compose world you can also try the following:

Check if your run configuration is Default Preview enter image description here

If so change to App

enter image description here

This should resolve this build error.

\app\build\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug\R.jar: The process cannot access the file because it is being used by another process.
Tonnie
  • 4,865
  • 3
  • 34
  • 50