Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

resConfigs per build type

Tags:

android

gradle

How can I override the resConfigs per build types? I read that flavors would allow that, but I don't use them. I just want for my debug build another set of supported languges.

Here is what I tried:

buildTypes {
    debug {
        resConfigs "de", "en" // allow also german in debug builds
    }
    release {
        signingConfig signingConfigs.release
        resConfigs "en"       // english only releases
    }
}

Any simple idea how I can achieve that?

like image 887
rekire Avatar asked Sep 09 '14 05:09

rekire


People also ask

How do I create and manage build configurations?

Understand build configurations. You can store different configurations of solution and project properties to use in different kinds of builds. To create, select, modify, or delete a configuration, you can use the Configuration Manager. To open it, on the menu bar, choose Build > Configuration Manager, or just type Configuration in the search box.

What is the project configuration in Visual Studio?

The project configuration determines what build settings and compiler options are used when you build the project. To create, select, modify, or delete a configuration, you can use the Configuration Manager. To open it, on the menu bar, choose Build > Configuration Manager, or just type Configuration in the search box.

How to build multiple configurations and platforms in Visual Studio?

If you want to build multiple configurations and platforms in one action, you can use the Build > Batch Build option in Visual Studio. To access this feature, press Ctrl + Q to open the search box, and enter Batch build.

What is a build configuration in react?

Build configurations are defined by a BuildConfig, which is a REST object that can be used in a POST to the API server to create a new instance. A build configuration, or BuildConfig, is characterized by a build strategyand one or more sources.


1 Answers

For some reason the individual buildType configs doesn't support the resConfigs command as you point out, but defaultConfig does and then you can use this trick to manipulate it per build type even without flavors configured:

android {
    defaultConfig {
        resConfigs "en"
    }
    applicationVariants.all { variant ->
        if (variant.buildType.name.equals("debug")) {
            variant.mergedFlavor.resourceConfigurations.add("de")
        }
    }
}
like image 147
Nilzor Avatar answered Oct 05 '22 07:10

Nilzor