How to create a directory folder in Android Studio?

33,567

Solution 1

Try to create package instead of a directory. Seems like Create New Package and Create New Directory will both just create a folder under lib directory.

Solution 2

You need to go File -> Project structure. enter image description hereSelect lib folder and unmark as source

Solution 3

Right click on the package then "Mark Directory as" -> Unmark as Sources Root. All child packages will be seen as folders.

enter image description here

Solution 4

I found a solution that worked for me In Mac OS,

1- Click over file and select project structure

enter image description here

2 - After, you should click on the lib folder, then unselect the "Source" from top

enter image description here

3- Then, click on Apply then Ok Buttons

4- Now when you try to create a directory on lib you will found the Directory option appears.

Hopefully, that's what you need.

Solution 5

Yeah I had the same problem, so you just have to follow these steps:

1) Go to project structure Here:

2) Go to Modules and find "Sources" tab Click here

3) Uncheck Sources and click "Apply"! (at the beginning it was unchecked and it didn't work, but when I checked "Sources", my folders changed as it was at the beginning(like packages), so I unchecked again and folders changed, and now I can create directories, not packages, hope it helped you!)

Like this:

Share:
33,567
Husna
Author by

Husna

Updated on January 19, 2021

Comments

  • Husna
    Husna over 3 years

    I'm using Android Studio and I want to create a directory folder inside the lib folder. I right-clicked on the lib folder but the directory option is not showing. Can anyone suggest to me how to create a directory folder inside a folder? enter image description here

  • Husna
    Husna almost 6 years
    but I want to create inside lib folder. How should I create?
  • Sachin Soma
    Sachin Soma over 5 years
    Creating nesting directory with packages looks like package1.pakage2
  • Jean-François Fabre
    Jean-François Fabre over 4 years
    "Another option". Okay, what's the original option? your answer is supposed to stand for itself.
  • Franco Rojas
    Franco Rojas almost 4 years
    why does it work only with "raw" and not for another name?
  • David Crow
    David Crow almost 4 years
    Does this have unintended side effects? It seems like the lib folder should be the sources root.
  • Usama Abdulrehman
    Usama Abdulrehman almost 4 years
    Can you simplify your answer in steps so its understood easily.
  • Admin
    Admin almost 4 years
    Kindly see the above edited answer hope it may help you solve your problem.
  • JAHelia
    JAHelia about 3 years
    this will disable indexing and so many behind the scenes functions in Android Studio