Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio, how to delete folder with references?

i would like to delete one folder (unused library) from my project in Android Studio. But i cannot to do that by delete key on keyboard or any other way.

I tried to found delete under refactor->safe delete, but this option is disabled.

If i removed folder manually from folder, Android studio created a folder again and putted in one .iml file, so i cannot delete folder again.

Thanks for any help.

like image 844
redrom Avatar asked Jan 18 '14 14:01

redrom


People also ask

Can I delete .android folder Android Studio?

You can safely delete this folder at any time (except maybe while Android Studio is still running!) All that will happen is that next time you use Android Studio: it will need to re-download some stuff.


3 Answers

  1. Remove it from settings.gradle
  2. Build --> Clean (the blue rectangle should disappear)
  3. Right click on module -->Delete
like image 132
easycheese Avatar answered Nov 15 '22 11:11

easycheese


To remove a module, you first have to delete it from .idea/modules.xml.

Once you do that and save the file, you'll be able to delete the folder, which will no longer be marked with the module's blue rectangle.

Don't forget to remove the module from settings.gradle.

I found this aswer at delete project in android Studio 0.3.4

like image 36
pimguilherme Avatar answered Nov 15 '22 12:11

pimguilherme


The problem is occurring because of workspace.xml and modules.xml inside .idea directory of your project.

You cant not delete any module if there is blue rectangle over it, Follow the steps to delete your module from project :

  1. Go to File> Project Structure , select the module you want to delete and press the red minus sign button to remove.

    Note : Also remove if any reference in build.gradle file of your main module.

  2. Clean your project using Build > Clean Project

  3. Close your Android Studio now

  4. Go to the project directory and delete the your_project.iml file and content of .idea folder from project root directory, also delete the module directory which you want to remove.

  5. Open Android Studio again and let it sync the project with gradle

  6. If module appears again there will not be any blue rectangle mark on it so you can delete by right click > delete and clean your project.

  7. Sync your project again with gradle, if it appears again check your event log if somewhere something from library is used, if it is remove them all.Check your File > Project Structure as well if there are any error referring to your module library on bottom. If it is using the red bulb button remove it.

  8. After remove all things Clean Your project and sync again.

Let me know in comments if any problem occurs.

like image 4
Piyush Agarwal Avatar answered Nov 15 '22 12:11

Piyush Agarwal