This translation from: the Where do the I at The Place 'Assets' Folder in Android Studio?
AM at The confused the About the I assets
Folder. I assets
clip confused file. It does not come auto-created in Android Studio, and almost all the forums in which this is discussed talk about Eclipse. It is not automatically created in Android Studio, the discussion of this subject almost all forums are talking about Eclipse.
How can the Assets directory be configured in Android Studio? How to configure directory Assets In Android Studio?
#1st Floor
Reference: https://stackoom.com/question/1EnLH/ How will Android-Studio - assets - where to put the folder
#2nd Floor
Android Studio uses since The new new Gradle Build System-based , you BE Should the putting assets/
Inside The Source of sets (EG, src/main/assets/
). Since Android Studio using the new system based Gradle build , so you should assets/
put concentrated source (e.g. src/main/assets/
).
An In A Typical Android Studio Project, you by Will have have AN app/
Module, with A main/
sourceset ( app/src/main/
OFF of at The Project root), and SO your Primary Assets Would Go in app/src/main/assets/
. In a typical Android Studio project, you will have a app/
module with a main/
Source set ( app/src/main/
outside the project root directory), so you will enter the main assets app/src/main/assets/
. However: However:
You need to specific Assets IF A Build, SUCH AS
debug
versusrelease
, you CAN Those for the Create sourcesets the Roles (EG ,.app/src/release/assets/
) If you need to build specific assets (egdebug
withrelease
, that these roles can create the set of source (for exampleapp/src/release/assets/
).Also have have CAN Product Flavors Your sourcesets with Assets (EG,
app/src/googleplay/assets/
) your product taste may also contain a set of resources with the assets (for exampleapp/src/googleplay/assets/
)Tests have have the Instrumentation CAN AN Your
androidTest
sourceset with Custom Assets (EG,app/src/androidTest/assets/
), though the Sure to BE at The ASKInstrumentationRegistry
forgetContext()
, notgetTargetContext()
, to Those Assets Access your detection test can have with a custom assetandroidTest
(for exampleapp/src/androidTest/assets/
), although it has toInstrumentationRegistry
requestgetContext()
insteadgetTargetContext()
to access these assets
Also, a quick reminder: assets are read-only at runtime. In addition, there is a brief reminder: assets at runtime is read-only. The Use Internal Storage , External Storage , or The Storage Access Framework for Read / Write Content. Use of internal memory , external memory or the Storage Access Framework read / write the contents.
#3rd floor
Inside at The .iml File of the Looking your Project by Will See you at The following Line: .iml file to view the project, you will see the following line:
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
This means the "assets" folder is already declared for Gradle. This means that already declared "assets" folder Gradle. By Will need to the Create IT by You an under src/main/
(the I'm a using Android Studio 0.4.2). You need to src/main/
create it down (I'm using Android Studio 0.4.2).
#4th floor
In android studio you can specify where the source, res, assets folders are located. In android studio, you can specify the location of sources, resources, assets folder. for each module / app in the build.gradle file you can add something like: For build.gradle file for each module / application, you can add the following:
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
sourceSets {
main {
java.srcDirs = ['src']
assets.srcDirs = ['assets']
res.srcDirs = ['res']
manifest.srcFile 'AndroidManifest.xml'
}
}
}
#5th Floor
The when Upgrading to at The Release Version of Android Studio, you May BE Automatically Switched to at The new new Android Project View (See here Wallpaper for More info). When you upgrade to the release version of Android Studio, you may automatically switch to the new Android project view ( For more information, see here ). If you swap back to either the Project or Packages view, you should see the standard folder hierarchy of a Gradle-based project. If the switch back to "project" or "package" view, you should see the Gradle project based on standard file folder Hierarchy. REFER to the Then CommonsWare's answer for at The Appropriate LOCATION. Then, referring to CommonsWare answer for the appropriate location.
#6th floor
Let Android Studio do it for you. Let Android Studio for you.
- Studio Android an In ( 1.0 & above ), the Click ON at The right- in Studio Android ( 1.0 and later ), right-click Folder and the Navigate to at The
Assets Folder
. Folder and navigate toAssets Folder
.
- The Just the Click the Next Screen at The ON
Finish
. On the next screen, clickFinish
.
And voila! Look! By Will the Create at The IT assets
Folder in at The main
target Source the SET. It will main
focus on the goal to create a source assets
folder.