Unable to clean project in Android Studio

后端 未结 22 1305
醉梦人生
醉梦人生 2020-12-17 07:49

OS version: Ubuntu 14.04 LTE 64 Bit

Java JRE/JDK version: Oracle JDK 1.8.0_11

Project directory is on a NTFS based drive.

Whenever I try to clean my

相关标签:
22条回答
  • 2020-12-17 08:06

    It should be a process lock the file handle. You can try to open your task manager to kill the process. In my case, the process is one of the Java process hold by Android Studio OpenJDK. Just find it and kill it.

    0 讨论(0)
  • 2020-12-17 08:07

    I had the same problem. To build the project again and again I had to delete the build folder each time. The problem for me was an anonymous program called ByteFence.exe running in my system. When I uninstalled that program my issue was solved.

    0 讨论(0)
  • 2020-12-17 08:08

    I stopped the windows defender it was locking the file because it was need to scan , and the problem resolved

    0 讨论(0)
  • 2020-12-17 08:10

    Just ran into the same issue now - I accidentally edited one of the generated files and wanted to rebuild the app, but both clean and build failed due to some files being locked.

    Luckily, I got cygwin on my Windows machine, so ls -l <file that studio complained about> revealed that these files were owned by some Administrator dude.

    My first thought was that these files might had been created while Studio was running with admin privileges (I do this when I need to fetch updates from SDK manager). The idea was to try and resolve this issue by executing clean in Studio running with admin privileges, and later rebuild with normal privileges. Nope, this did not work :(

    I decided to go for the brute force: sudo rm -rf app/build/* (in Cygwin this command looks a bit different: cygstart --action=runas rm -rf app/build/*). This resolved the issue and I was able to rebuild the project in Android Studio.

    0 讨论(0)
  • 2020-12-17 08:10

    Go to your projects directory in the terminal and run gradlew clean

    To run a Gradle command in your terminal/command prompt. Navigate to the root of your project and type gradlew in the terminal or gradlew.bat for the command prompt (windows users), followed by the command you would like to execute.

    For a list of all possible gradle commands type gradlew tasks into your terminal.

    0 讨论(0)
  • 2020-12-17 08:10

    I solved this issue by closing android studio -> remove android platform via cli and then -> add the android platform again -> open project in android studio.

    0 讨论(0)
提交回复
热议问题