gradle资源目录动态配置

// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
   'main',     // main sample code; look here for the interesting stuff.
   'common',   // components that are reused by multiple samples
   'template'] // boilerplate code that is generated by the sample template process

android {
   compileSdkVersion 27

   buildToolsVersion "27.0.2"

   defaultConfig {
       minSdkVersion 19
       targetSdkVersion 27

   }

   compileOptions {
       sourceCompatibility JavaVersion.VERSION_1_7
       targetCompatibility JavaVersion.VERSION_1_7
   }

   sourceSets {
       main {
           dirs.each { dir ->
               java.srcDirs "src/${dir}/java"
               res.srcDirs "src/${dir}/res"
           }
       }
       androidTest.setRoot('tests')
       androidTest.java.srcDirs = ['tests/src']

   }

}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容