This is how it looks:
and when I create a new subdirectory this way
the newly created directory doesn't show up under 'res.'
But if I go to the physical location of res,
AndroidStudioProjects/MyFirstApp/MyFirstApp/app/src/main/res
There is a new folder with the name under which I created a directory.
Why is it happening?
I closed and restarted android studio, but it doesn't fix the problem.
Thank you very much for your help.
Android Studio --> Project Tab on Left side --> Choose Project from Spinner, not Android Item. And You can add folder. If It is not clear, I can share picture for more.
Related
I want to add a new vector asset. I am trying to add a clipArt but it only shows in the dialog box "Nothing to show". No icon is showing and I want to add an icon. I don't know to fix this. Please help. I am still trying to learn android studio and I am practicing on how to use it.
For myself, my asset dialog only shows some of these icons. And here is my solution.
Go to
[SdkPath]/icons/material
There should be a file called icons_metadata.txt, and folders
materialicons
materialiconsoutlined
materialiconsround
materialiconssharp
materialiconstwotone
For each icon, there will be one folder in the folders above. For example, we have materialicons/share, materialiconsoutlined/share and so on.
These icon folders are not complete, only icons starting with digits exist. Since the folder only updated when "Select Icon" dialog is opening, I opened "Select Icon" dialog again, waiting for all icons are downloaded, and then reopen the dialog.
Then my problem is solved.
This a new problem introduced in the latest version of Android Studio 4.1.
This happens when your windows user name folder contains a space. Rename your user name’s folder removing the space and it will work again.
For some reason the space make the folder where the icons are located not visible to Android Studio.
If there are already this folders and still nothing in dialog try deleting <sdk>/icons/material/icons_metadata.txt
Credit to
#MainActivity
Those clip arts are located in "icons" folder inside your sdk folder on your hard drive and the sdk folder is generally this:
C:\Users\ --username-- \AppData\Local\Android\Sdk
I guess android studio cannot access the right sdk location so make sure the sdk location in your "File/Project Structure/SDK Location" matches the actual sdk location on your hard drive.
Alternatively, you can download the clip art you need from this link: Android Material and import them by choosing Local file in your Asset Studio.
In Android Studio 4.1.1 this issue is resolved. Update if possible.
It's working
Your SDK folder name must be spaced less, ex- (UTTAM, UttamSdk, Uttam_sdk)
HAPPY CODING :)
Same thing happened with me, also i was not able to change my user name because of Win 10 Single Lang. so i just moved my SDK folder to another path but there was not space between the path like from >> C:\Users\User Name\AppData\Local\Android\Sdk to >> C:\Users\Sdk.
currently, I am working on a android side project in my free time. As my project grows, I change the project structures so that I can maintain it easily. But whenever I add a sub-folders, the android studio automatically changes the structures as shown below.
If I go to the actual project folder, it is properly structured as "Fragments" folder contains "SignupFragments" sub-folder.
Does anyone know how to fix this?
The solution was un-checking "compact empty middle packages" in the directory setting options by clicking the gear button.
So in my project view I have only a drawable file. I'm following a book tutorial at the moment and it has drawable-ldpi etc. so to avoid confusion I thought I'd crate them too. The problem is that when I created my drawable-ldpi file, it simply didn't appear in my res folder, even after refreshing an restarting android studio.
I tried to create it again, and it says the directory already exists. What am I doing wrong here? why aren't the directories I've created appearing in my res folder?
EDIT - Android project tree
From the top left corner, just above App folder, where you see Android - with dropdown icon. Click on it and select project file from drop down options.
You can also select "Project"
I would like to use a png as a button in android studio. I tried adding the png into the drawable folder in my android project folder, however, when I open my android studio under res there is only one drawable folder with 4 launcher.png and no matter how i try to copy my png in there (over windows folder or directly over android studio) it doesn't work and won't show up. Furthermore, how do I use the png as a button in the xml layout?
Thanks in advance!
Click on the drawable folder, right click, select import and navigate to the png directory, select the .png file. If that doesn't work, then there is something wrong with your project or eclipse.
As for using it as a button, google has plenty of examples.
I am using Android Studio, so I selected optimize imports and then it shows you the folder path. I copied the png in there and hit run after clicking optimize imports now it's there .
I've googled for the answer and read many forums and stackoverflow threads but I still can't get it to work.
I just started trying to develop my first Android app, and after following the instructions listed on the website, when I started the project, it opened with two tabs, one showing a java file, and the other showing an xml file. The tab with the xml file also had this simulation of an android phone on it where I could play around with the GUI.
When I stopped working on it, I closed all the tabs and closed eclipse, but now I want to work on it again and I don't know how to get it back to the setup showing the java and the xml file with the little simulation. I don't even know where the activity_main.xml is located.
I don't want to create a brand new project.
I tried importing a project, but the finish button is always grayed out or it wont let me import because it says that a project already exists in the workspace, or after I click on the folder containing all the bin, res, src, etc. files, and I click OK to import it, nothing happens.
Is it possible to just click on a single file, like the .sln file in visual studio, that will automatically launch eclipse with your project ready to go?
The activity_main.xml is located in your_project/res/layout.
Just open Eclipse and navigate to this directory in Package Explorer window:
When you double click the activity_main.xml you should see the XML and Graphical Layout tabs at the bottom.
Here is a description of android project structure:
http://developer.android.com/tools/projects/index.html#ApplicationModules
Make sure you uncheck the copy attribute when you import the project, this solve the project is already exit problem, and you can try both Existing Project Into Workspace and Existing Android Code Into Workspace.
The layout file lay in project_name/res/layout.
Source file lay in project_name/src.
You can double click to open your files, and your files remain open the next time you open eclipse, only if you don't close them when you exit the eclipse.
There are a few ways to reopen your project again:
Try to open the project explorer:
-> Window -> View -> Project Explorer -> Hit refresh
Open your .project file (in your workspace) an edit the name in the xml name tag and try do import again.
Please make a backup before.