Android Studio : The process cannot access the file because it is being used by another process (Jetpack Compose)

Viewed 697

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

2 Answers

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