I added res directories in android studio for my android project. I added them using the IDE as well as manually with mkdir res_dir. However, they do not show up on the project tree. I want to view them on the tree so I know for sure they are in the project rather than ls every time to check. I tried restarting my IDE but this problem is still there
I added the res directories: drawable-hdpi, drawable-ldpi, drawable-mdpi, drawable-xdpi but I do not see them on the tree. How can I make these appear?
Add some files into the folders, this will show up the folders inside drawable.
Related
I made a UI layout using adobe XD and wanted to export it to use in android studio.
I achieved this by using the Export-kit plugin, which conveniently exported all my required assets for one page into a folder.
Exported assets folder
the readme.txt then directs me to copy all these assets to the folder for the noactivity project folder for android studio.
after doing so , I still don't get any response.
So, I try it with a basic activity and manually add all the required XML codes (activity_main,colours,styles,e.t.c) , but still don't see anything.
I know that the skins exported from xd are in the project folder
(Copied values in the projects folder)
but I cant seem to view them on android studio.
Android Studio Window
any help in this issue will be really appreciated.
You have to put those files in the drawables folder inside the res folder, and keep the colors, string into their respective folder in the values folder inside res.
I imported a number of image assets, and I copied the assets into the project by copy/paste them into the project via Finder on my Mac. I've done a clean/rebuild on the project, and the files & directories showed for a moment, but then they disappeared. Now I can't get the files and the directories to show up. The files are clearly in the directory and project, but they don't show in Android Studio. They are labeled drawable-hdpi, drawable-mdpi, and so on. Here is an image of the files:
Here is my Android Studio:
Switch in project view will show you all folders for example drawable.hdpi and so on check all these folder for all images.
It turns out that I added my images to the drawables directory rather than the resources directory! Ugh...
I'm trying to add an Assets folder to my Android Project in Android Studio 2.1.2. I right click on the project and choose New -> Folder -> Assets Folder. In the project pane on the left, it doesn't show up when Android is selected. If I switch to Project Files, it does appear, however it looks like a normal directory, rather than looking like a resource directory. I then tried adding files to it (jpgs), both through Android Studio and through the file explorer (all file names are lowercase with no special characters). If you unzip the apk that gets created though, it doesn't contain an Assets directory or the added files. Also sometimes the assets directory will disappear from the project files pane, although it's still in explorer.
What step am I missing to get to the Assets directory properly added to my project?
Note: this is for a LibGdx project that expects image files to be there.
Finally got it. Appears to be a bug in Android Studio, but to make it work, in the Project pane, go to Android view and (this next part is critical) right click on the res folder and go to New->Folder->Assets folder. You might want to click change folder location to be sure it's going into the main folder (mine was) just to be on the safe side.
You must right click on the res folder. That was my issue. If you right click on the module or anywhere else, even though the folder will get created in the proper spot, Android Studio and gradle won't treat it as a resource directory and just ignores it.
Be sure to create folder in app/src/main/ and call it assets.
For me in Android Studio 3.6.2, the assets folder wasn't showing up in the "Android" view, no matter where I tried to create it, after trying the other suggestions here. In the "Project" view it showed up in app/assets as a plain folder. I then drag-and-dropped it to src/main/assets and it automatically changed its icon to the same icon as the res folder, and after this it is now also showing up in the "Android" view, so I guess Android Studio is picking it up correctly now, and it appears to be a bug in Android Studio.
If you created a folder in your res directory and named it "assets" and now as "Nullqwerty" mentioned you could not able to solve your problem and you face to the duplication error, just go to the project tab (or press Alt + 1) and in the view mode, change it from "Android" to "Project", then expand all folders in your project to find assets folder in your src\main\res directory (or in src\main path) and right-click on your "assets" folder (if you created it before by adding a "Directory" and named it assets), then change your view mode from "Project" to "Android", again, and right-click on "res" directory->New->Folder->Assets Folder. Then click on "Finish" button to see the assets folder on your main directory as you want. That's it ;)
I am using Android Studio 2.1.1 (currently the most updated stable version).
I created new directory inside 'res' by name "values-21"
and it don't shows up.
But if I go to the physical location of 'res' on the hard drive I can see that its exist.
and of course I checked using both Android and Project Files structure but either way its not showing it.
I wanted to check where is the problem so I created another directory by name "menu", and the last one was shown.
just to be sure I tried to create the same directory again ("values-21") but Android studio didn't allowed it because this directory allready exist's.
any ideas how to fix it?
Update - the solution is to create new directory using the "Android resource Directory" option and not by "Directory" option.
all you values xml files stored in values, values-21, values-mdpi or other physical folder in AndroidStudio displayed in one res/values folder.
It will not show until you copy a XML file into values-21, android studio consider all values folders to be of same family and it shows only one folder and the files with post script of the family in which it lies.
copy some layout file from resource directory and through windows explorer paste in that the folder that you have created i.e values-21 and now come back to android studio and check the folder should be there.
Happy coding
I'm developing an Android application and I want to add a custom font. I read about the epic assets folder and her location over some themes like this. I check my src folder - it's not there. I check almost every single directory from my project tree and I still can't find her. Here is the picture of my directory tree.
And by the way, on my previous project, on Android 0.6 I used to add a custom font but I don't remember where was the folder located and now, on Android Studio 0.8 I even can't find my folder.
Under your main folder you need to make an assets directory.
Right click on the "main" folder -> New -> Directory
And then name it "assets" and here is what it should now look like (minus the xml file of course)
Todays IDEs do most of the work for you. But if they fail, why you not just try to do it yourself? Place your assets-folder in src\main\assets and you should be fine.