Where to place the 'assets' folder in Android Studio?

后端 未结 22 3266
醉酒成梦
醉酒成梦 2020-11-22 01:59

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.

22条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 02:24

    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'
            }
        }
    }
    

提交回复
热议问题