How I can apply a network_security_config.xml on specific variants and not in release one?

Dimitrios Desyllas - Mar 22 '22 - - Dev Community

I want self-signed certificates to be applied in a specific variant and NOT in release or staging ones. Is there a way to do so?

More Info on:

In my build.gradle I have the follwing buildTypes:

buildTypes {
        release {
            //debuggable true
            minifyEnabled false
            signingConfig signingConfigs.config
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField "String", "SERVER_DOMAIN", "\"api.example.com\""
        }
        debug {
            minifyEnabled false
            buildConfigField "String", "SERVER_DOMAIN", "\"api.local\""
        }

        staging {
            initWith debug
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField "String", "SERVER_DOMAIN", "\"https://api.staging.example.com\""
        }
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player