Android define different variables for different build types and use it in manifest file.

This is in the app build.gradle file, it defines the variable usesCleartextTraffic to be used in the manifest file. As you can see there are 3 build types, dev, qa and release. For dev the value is set to true and false for qa and release. While in development, an encrypted traffic is not needed and it is not available sometimes in a local environment. For example, when developing react native, the local server is not https unless it is configured to support https.

android {
  buildTypes {
      dev {
          manifestPlaceholders.usesCleartextTraffic = "true"
      }
      qa {
          manifestPlaceholders.usesCleartextTraffic = "false"
      }
      release {
          manifestPlaceholders.usesCleartextTraffic = "false"
      }
  }  
}

Here is how to use the usesCleartextTraffic defined in the gradle file in manifest.xml


    
    

References:
https://developer.android.com/studio/build/manifest-build-variables

Search within Codexpedia

Custom Search

Search the entire web

Custom Search