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...
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.
How can I copy the following type of image asset so that I can use it in a different project? I was able to copy and paste a single png but not the whole set of images.
This project is a sample project from google codelabs.
Since the resources are in separate dpi folders, you need to copy the folders over, which is not possible in the "Android" view. If you click on the drop down, you should be able to get to a "Project Files" view where you can copy all the folders. Alternatively, you can use an external file explorer to copy the folders.
The easiest way is to navigate to where the project is stored. Once inside your application's folder, click app -> src -> main -> res -> drawable and select the images you wish to copy to another project. You can drag and drop these into your new android studio project or copy/paste them into the drawable folder in the new project's files as well.
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 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.
I would like to know where can I find the back button image, the one used by the android tablet emulator.
All the images which are used by the android platform are placed in the drawable folder under the res directory.
1.Open the android root directory(Installed directory).
2.Navigate to the res directory.E:\android-sdk-windows\platforms\android-12\data\res
You will find it in the android.jar file in your sdk folder.
For example mine is in C:\Program Files (x86)\Android\android-sdk\platforms\android-8\android.jar (for SDK version 8, to get a different version the change the "android-8" part of the path)
You can extract the .jar using winzip/7z etc as it is just a zip file in disguise. You will then find the drawables folder in the folders you unzipped.