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.
Related
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'm trying to copy and paste a whole bunch of files/folders into my Assets folder (that I created in the Main folder by selecting New > Folder > Assets Folder). But I get this error:
Cannot create class-file
The file in question is GUIDemo.class but there are others like it, too. Any suggestions how I can copy and paste the assets files into my project?
Android Studio uses Gradle-based build system, you should
putting assets/ inside of the source sets (e.g., src/main/assets/)
or create a folder under res
Try right click your app -- New -- Folder-- Assets folder
Change Android tag to Project, right click src --- make module app
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.
I'm pretty new to android. I stuck at a point where I need to add a downloaded .rar file for icons, stencils and color swatches into Eclipse (the RAR file has been downloaded from official android developer site.here is the link).
Is there any way to directly copy and paste in ADT bundle root folder and use it or we have to do it by copying and pasting into the drawable folder each of the required itens?
Put it in the "res" folder of your android project.
Just drag and drop (or copy past) an image in the "drawable" folder.
You have to do that for each item.
If you have different size for an image you can put the ressources of your image in those folders: "drawable-hdpi", "drawable-ldpi" and "drawable-mdpi".
Each folder represent a screen size for your device.
Note that each ressource must have the same name (Eclipse should manage it).
You can do it for all the images by copying the images CTRL + C then in Eclipse select drawable(hpdi,...) folder, right click -> Paste
Or
1 - Extract the RAR file
2 - Store the contents of the extracted folder in ZIP format
3 - Right click (the project) -> import -> General -> Archive File
4 - Move the imported content to the required res folder (drawable ,drawable-hpdi,...)