使用不同的资产文件夹进行调试和发布

时间:2017-06-21 02:19:00

标签: android gradle

这是我的app的build.gradle,我想使用'assets / test1'作为我的调试资产文件夹,并使用'assets / test2'作为我的发布资产文件夹。我将txt文件test1.txt放到'asset / test1'并将txt文件test2.txt放到'asset / test2'。不知怎的,我发现构建中间目录'build \ intermediates \ assets \ debug'或'build \ intermediates \ assets \ release'中没有test1.txt或test2.txt。 资产文件夹中有3个.ttf文件,我不知道它们来自哪里。

----------------------------------------------- build.gralde ----------------------------

sourceSets{
    main{
        assets.srcDir 'assets/common'
    }
    debug.assets.srcDirs = ['assets/test1']
    release.assets.srcDirs = ['assets/test2']
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        //assets.srcDirs = ['assets/test1']
    }
    debug{
        //assets.srcDirs = ['assets/test2']
    }
}

------------------------------------ dir / s命令------- -----------------------

 Volume in drive D is APP
 Volume Serial Number is 669E-F27F

 Directory of D:\code\PJShort\Test\app\build\intermediates\assets

16/06/2017  06:24 p.m.    <DIR>          .
16/06/2017  06:24 p.m.    <DIR>          ..
16/06/2017  06:24 p.m.    <DIR>          debug
               0 File(s)              0 bytes

 Directory of D:\code\PJShort\Test\app\build\intermediates\assets\debug

16/06/2017  06:24 p.m.    <DIR>          .
16/06/2017  06:24 p.m.    <DIR>          ..
16/06/2017  06:24 p.m.    <DIR>          fonts
               0 File(s)              0 bytes

 Directory of D:\code\PJShort\Test\app\build\intermediates\assets\debug\fonts

16/06/2017  06:24 p.m.    <DIR>          .
16/06/2017  06:24 p.m.    <DIR>          ..
13/06/2017  12:25 p.m.            32,303 helvetica.ttf
11/05/2017  02:29 p.m.             2,104 materialdrawerfont-font-v5.0.0.ttf
13/06/2017  12:25 p.m.           414,820 notosans.ttf
               3 File(s)        449,227 bytes

     Total Files Listed:
               3 File(s)        449,227 bytes
               8 Dir(s)  36,491,513,856 bytes free

0 个答案:

没有答案