How to create a directory folder in Android Studio? - android-studio

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?

You need to go File -> Project structure.
Select lib folder and unmark as source

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

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.

I found a solution that worked for me In Mac OS,
1- Click over file and select project structure
2 - After, you should click on the lib folder, then unselect the "Source" from top
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.

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:

This was reported here
It's an IntelliJ issue in how they deal with folders marked as source. The lib folder needs to be a source folder for internal flutter purposes. The best way is to use your file manager or terminal to create the folder.

Step 1: There is no pre featured option in Android for adding raw folder unlike Assets folder. Open App folder and select res folder
Step 2: Right click on res folder, select New> Directory, then studio will open a dialog box and it will ask you to enter the name.
Step 3: Write “raw” and click OK. Open res folder and you will find your raw folder under it.
Now you have created raw folder in your project.

You can use the in-built IDE terminal to create the folders.

Here is complete solution that works. Click the link to see images.
Issue
Problem- Cannot create Directory
1)Cannot Create Directory
Click the Gear icon and Untick Compact Middle Package
2)Click Gear icon and Untick Compact Middle Package
Package Structure gets expanded
3)Now Expanded Package View can be seen
Still Not possible to create Directory
4)Still cannot create package
Do as shown in the image
5)Right click Package COM->Mark Directory as->Unmark as Source root
Packages are expanded and now you can create Directory
6)Now the packages are expanded and now Directory can be created

For creating the folder in case of flutter framework in Android studio, follow the steps as shown below:-
Right click on the folder with the name of your app i.e. the root folder.
In the drop down menu click on the new option.
After this a drop down menu opens here you will see directory option just click on that.
After this enter the name of your directory / folder and press enter this will create a new folder / directory inside your root folder.
If you want to make the directory inside the lib folder then just drag the directory from the root folder into the lib folder.
After this a dialog box will open in this dialog box check if search for references is tick marked or not if not then tick mark it.
Now click ok this will create your directory inside the lib folder.
Hope this may help.

Related

Why can't I copy/paste img assets from one project into new directories in second project's drawable folder?

I downloaded a project from Github, trying to rebuild it myself for learning purposes. I'm new to Android Studio, developing on a Mac. Having trouble with what I think would be simple tasks.
The source project from Github I downloaded has several different sub directories containing image resources under the res/drawable folder. I was hoping I could just copy and paste these assets into my own project. It doesn't seem to work the way I'd expect and I don't understand what is going on.
I've tried right clicking and copy/pasting the directory I'd like to duplicate from the Github project (opened in Android Studio) into the drawable folder in my new project (Also opened in AS). Nothing seems to happen when I do this. Right clicking and selecting "reveal in finder" reveals a still unfortunately empty drawable folder.
I also tried right clicking on the specific directory I'd like to copy from the Github project and selecting "reveal in finder", thinking I'd try copying and pasting it from there into my new project. Oddly enough when I do this, the same directory isn't even the one that's opened. Instead, it opens a drawable-hdpi folder containing several assets, but it's definitely not the one I was attempting to open.
I've tried right clicking and "synchronizing" the drawable folder in my new project after copy/pasting, still no luck.
You can not copy android folders or directories directly into android studio. But you can copy individual files into there respective folders in your project.
If you want to copy folders/ directories you can open the android app folder in your MAC browser and go to Application/app/src/main and paste whatever you have in the respective folders.
The main folder conrains java and res folders and an AndroidManifest.xml file.
You can paste xml files , drawables and pngs etc in res and java classes will go into java folder.

How do you create a folder in Android Studio

File -> New and the context menu dont have an option of creating a folder, just files and other stuff.
I'm making a flutter app and want a new folder insie lib.
Or right-mouse click on a parent folder and New -> Package
Right click on the lib folder, select New and then select Package.

Visual Studio Installer, how can i select any folder using custom dialog

I have made a setup project using Visual Studio Installer. Now in this setup project I just want to have a custom dialog box which have one textbox and one button(BrowseButton), when I click this button a popup for selecting a folder in the target machine may appear.
In other words I want The "Browse For Folder button" or ""browser button" so that I may select any folder in the target machine. Once I select a folder the path should now come in the textbox. Because in the end I would like to save this path in the registry of the target machine.
I have Orca and I did tried to make this custom dialog using it but I am unable to do it.
There is only one browse dialog in those setups, and that's for the main application folder, so there isn't a way to do this. A custom action won't help because they all run after the files are installed.
I don't know why and where you need to browse to, but in most case there is a simple default location (such as an application data folder or a shared folder) that works fine. This really helps during upgrades when the upgrade install may need to do something with that variable location, and any apps will always know where it is. It's easier for the user too.

How to remove a folder from a MonoTouch project?

In MonoDevelop I can right click a file in a MonoTouch project and select "Remove" and it then gives me an option of removing the file from the project. However, if I right click a folder, the only option available is "Delete" which brings up a confirmation box saying that the entire folder will be deleted. How do I remove a folder from a MonoTouch project? Does this functionality exist somewhere or has it not been built yet?
I think the easiest way to do this is to handle all the files outside of monodevelop. Just move it to wherever you like and then delete the folder from inside monodevelop.

How can I selectively delete a Start Menu folder with NSIS?

I am using NSIS to create install and uninstall wizards to my rather simple app for Windows.
The situation is, my NSIS script creates a shortcut to the app in the Start Menu folder for the installation wizard. So far no problem. Other apps (related with mine) install their shourcts in the same Start Menu Folder too.
The problem is in the uninstall process. I can delete my shortcuts without a problem but, what about of the folder in the Start Menu? I cannot delete it if there are apps alredy there but I would like it to be removed if the folder is empty.
How can I check using the NSIS script if the folder is empty and therefore condition if the deletion of the folder has to happen or not?
Although is not vital I don't like to have empty useless folders cluttering my Start Menu view.
Thank you very much in advance!
Julen.
RMDir "$SMPrograms\yourfolder" will only delete the folder if it is empty

Resources