Where do I place the 'assets' folder in An

2018-12-31 05:57发布

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?

19条回答
忆尘夕之涩
2楼-- · 2018-12-31 06:26

When upgrading to the release version of Android Studio, you may be automatically switched to the new Android project View (see here for more info). If you swap back to either the Project or Packages view, you should see the standard folder hierarchy of a Gradle-based project. Then refer to CommonsWare's answer for the appropriate location.

查看更多
与君花间醉酒
3楼-- · 2018-12-31 06:27

Put the assets folder in the main/src/assets path.

查看更多
有味是清欢
4楼-- · 2018-12-31 06:29

In android studio you can specify where the source, res, assets folders are located. for each module/app in the build.gradle file you can add something like:

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    sourceSets {
        main {
            java.srcDirs = ['src']
            assets.srcDirs = ['assets']
            res.srcDirs = ['res']
            manifest.srcFile 'AndroidManifest.xml'
        }
    }
}
查看更多
旧时光的记忆
5楼-- · 2018-12-31 06:30
Src/main/Assets

It might not show on your side bar if the app is selected. Click the drop-down at the top that says android and select packages. you will see it then.

查看更多
与君花间醉酒
6楼-- · 2018-12-31 06:30

In Android Studio, click on the app folder, then the src folder, and then the main folder. Inside the main folder you can add the assets folder.

查看更多
零度萤火
7楼-- · 2018-12-31 06:33

Either create a directory under /app/src/main or use studio File-> New -> Folder - > Assets Folder.

查看更多
登录 后发表回答