How to "assets" in the folder where to put Android Studio will be?

This translation from: the Where do the I at The Place 'Assets' Folder in Android Studio?

AM at The confused the About the I assetsFolder. I assetsclip 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 debugversus release, you CAN Those for the Create sourcesets the Roles (EG ,. app/src/release/assets/) If you need to build specific assets (eg debugwith release, that these roles can create the set of source (for example app/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 example app/src/googleplay/assets/)

  • Tests have have the Instrumentation CAN AN Your androidTestsourceset with Custom Assets (EG, app/src/androidTest/assets/), though the Sure to BE at The ASK InstrumentationRegistryfor getContext(), not getTargetContext(), to Those Assets Access your detection test can have with a custom asset androidTest(for example app/src/androidTest/assets/), although it has to InstrumentationRegistryrequest getContext()instead getTargetContext()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.

  1. Studio Android an In ( 1.0 & above ), the Click ON at The right- in Studio Android ( 1.0 and later ), right-click Enter here captionsFolder and the Navigate to at The Assets Folder. Folder and navigate to Assets Folder.

Enter here captions

  1. The Just the Click the Next Screen at The ON Finish. On the next screen, click Finish.

Enter here captions

And voila! Look! By Will the Create at The IT assetsFolder in at The maintarget Source the SET. It will mainfocus on the goal to create a source assetsfolder.

Enter here captions

Original articles published 0 · won praise 73 · views 550 000 +

Guess you like

Origin blog.csdn.net/w36680130/article/details/105239791
Recommended