I am confused about the assets
folder. It doesn't come auto-created in Android Studio, and almost all the forums in which this is discussed talk about Eclipse.
How can the Assets directory be configured in Android Studio?
I am confused about the assets
folder. It doesn't come auto-created in Android Studio, and almost all the forums in which this is discussed talk about Eclipse.
How can the Assets directory be configured in Android Studio?
Simple follow this
File > New > folder > assets Folder
Note : App must be selected before creating folder.
Since Android Studio uses the new Gradle-based build system, you should be putting
assets/
inside of the source sets (e.g.,src/main/assets/
).In a typical Android Studio project, you will have an
app/
module, with amain/
sourceset (app/src/main/
off of the project root), and so your primary assets would go inapp/src/main/assets/
. However:If you need assets specific to a build, such as
debug
versusrelease
, you can create sourcesets for those roles (e.g,.app/src/release/assets/
)Your product flavors can also have sourcesets with assets (e.g.,
app/src/googleplay/assets/
)Your instrumentation tests can have an
androidTest
sourceset with custom assets (e.g.,app/src/androidTest/assets/
), though be sure to ask theInstrumentationRegistry
forgetContext()
, notgetTargetContext()
, to access those assetsAlso, a quick reminder: assets are read-only at runtime. Use internal storage, external storage, or the Storage Access Framework for read/write content.
Let Android Studio do it for you.
Assets Folder
.Finish
.And voila! It will create the
assets
folder in themain
target source set.need configure parameter for gradle
i hope is will work
Step 1 : Go to Files. Step 2 : Go to Folders. Step 3 : Create Assets Folder.
In Assets folder just put fonts and use it if needed.
Looking inside the .iml file of your project you will see the following line:
This means the "assets" folder is already declared for Gradle. You will need to create it under
src/main/
(I'm using Android Studio 0.4.2).