Android Studio newly created folders not showing - android

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

Related

Can't import assets from adobe XD into android studio

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.

Xamarin Android assets folder not updating when building the solution

I have a Xamarin.Forms app that needs to read data from a json file. I placed the file into the Android assets folder and selected the build action AndroidAssets
Then I try to load the file in MainActivity with Assets.Open(filename) and I get a FileNotFoundException. I deleted the Android and PCL bin folders and tried to build the project again but got the same result. Then I opened the .apk file in WinRar and when I go to the assets folder, the files that I added to the project are not there.
Does anyone have any idea what's the problem here?
Did you set the files as embedded resources from the file properties?
If you not, right click on the file -> Properties -> set as Embedded Resources in Build Action
The problem was with using the "-" character in resource file names. Changed it as suggested by York Shen and it started working as it was supposed to.

Assets Folder Not Getting Added To Android Studio Project and APK

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 ;)

Can't find my assets folder

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.

R.java file doesn't allow creation of new folder in the project

I have been trying to create a folder manually to keep all the styling xml files inside my android project using eclipse in windows 7. As soon as I create a xml file inside that new folder and save the xml file. My R.java goes missing. I understand that R.java is not taking in the manual changes to the project. I believe there is a way we can make changes to the project by manually adding folders and reflecting the changes to the R.java file accordingly.
So can anyone please help me out as to what do I have to do to allow manual changes in my project as described above?
the only way you can create a styles xml file, is inside a values folder, so you can't assemble all the styles files inside one folder, android will not recognize it, thus, not allowing what you are trying to do
here is a link to follow when creating a folder,
http://developer.android.com/guide/topics/resources/providing-resources.html
check this part within Table 1. Resource directories supported inside project res/ directory.
Styling XML files should go someone in your RES folder, typically some flavor of "values" (like just "values" or "values-hdpi", etc.)
Putting them somewhere else can cause errors, usually they just can't be used but also could cause Eclipse to not be able to build the R.java file correctly.

Categories

Resources