Can I exclude regional resources (e.g. values-fr) when building a particular Android Product Flavor with gradle

前端 未结 2 1620
眼角桃花
眼角桃花 2020-12-18 03:50

Say I have this directory structure:

app
--src
   |--main
   |   |--java
   |   |--res
   |       |--drawable
   |       |--values
   |       |--values-fr
           


        
相关标签:
2条回答
  • 2020-12-18 04:29

    The final working solution is to include a language - in this case, only German (de):

    productFlavors {
        flavour3 {
            resConfigs 'de' // include '-de' resources, along with default 'values'
        }
    }
    

    As a reference, you can also check the list of country codes from ICU here.

    0 讨论(0)
  • 2020-12-18 04:49

    You can exclude those folders by using this snippet:

    sourceSets {
      flavor3 {
        main {
          resources {
            srcDir 'res'
            exclude '**/values-fr/**'
          }
        }
      }
    }
    
    0 讨论(0)
提交回复
热议问题