Adding an assets folder in Android Studio
Asked Answered
D

5

80

Android Studio has changed its project structure yet again... now it is

project
└── app-module
    ├── manifests
    ├── res
    └── java

I've been looking everywhere online, but I can't find where to put the assets folder. When I try to create the folder via the directory viewer in Android Studio (right-click, New... directory) the "directory" option is not available. The only available options are:

Java Class
File
Module
Package
Image Asset

None of which will do what I want here.

Has anyone figured this out?

Deucalion answered 3/11, 2014 at 2:14 Comment(1)
This is the complete answer with image guidance enter link description herePharmacy
R
104

You can click on the Project window, press Alt-Insert, and select Folder->Assets Folder. Android Studio will add it automatically to the correct location.

You are most likely looking at your Project with the new(ish) "Android View". Note that this is a view and not the actual folder structure on disk (which hasn't changed since the introduction of Gradle as the new build tool). You can switch to the old "Project View" by clicking on the word "Android" at the top of the Project window and selecting "Project".

Ralline answered 3/11, 2014 at 2:17 Comment(3)
You can also do this in the "Android view": right click on the name of the module where you want the assets folder and navigate to New -> Folder -> Assets Folder.Kata
I tried to create assets folder manually didn't work, had to follow above procedure :D ThanksYehudi
Thank you this is very simple and straight forward way doingCongruous
S
188

An image of how to in Android Studio 1.5.1.

Within the "Android" project (see the drop-down in the topleft of my image), Right-click on the app...

enter image description here

Squint answered 16/12, 2015 at 15:1 Comment(2)
Thanks for this. I wasted about 10 minutes clicking everywhere looking for thisChurchly
Thanks a lot!! Picture is indeed worth a thousand words :)Daniels
R
104

You can click on the Project window, press Alt-Insert, and select Folder->Assets Folder. Android Studio will add it automatically to the correct location.

You are most likely looking at your Project with the new(ish) "Android View". Note that this is a view and not the actual folder structure on disk (which hasn't changed since the introduction of Gradle as the new build tool). You can switch to the old "Project View" by clicking on the word "Android" at the top of the Project window and selecting "Project".

Ralline answered 3/11, 2014 at 2:17 Comment(3)
You can also do this in the "Android view": right click on the name of the module where you want the assets folder and navigate to New -> Folder -> Assets Folder.Kata
I tried to create assets folder manually didn't work, had to follow above procedure :D ThanksYehudi
Thank you this is very simple and straight forward way doingCongruous
G
16

According to new Gradle based build system. We have to put assets under main folder.

Or simply right click on your project and create it like

File > New > folder > assets Folder

Glenine answered 8/3, 2016 at 10:41 Comment(3)
I haven't noticed any restriction in regards to where you can place an assets folder. Is the src/main/assets a special case?Waybill
your asset folder must be under src/main/Glenine
Consider my answer below, I'm adding an asset folder directory which does not reside in src/main/. It worksWaybill
W
6

To specify any additional asset folder I've used this with my Gradle. This adds moreAssets, a folder in the project root, to the assets.

android {
    sourceSets {
        main.assets.srcDirs += '../moreAssets'
    }
}
Waybill answered 28/10, 2016 at 15:51 Comment(0)
U
3

right click on app-->select

New-->Select Folder-->then click on Assets Folder

Utilitarian answered 1/12, 2017 at 10:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.