android tutorial - Specifying different application IDs in Android | Developer android - android app development - android studio - android app developement



Specifying different application IDs for build types and product flavors

  • You can specify different application IDs or package names for each buildType or productFlavor using the applicationIdSuffix configuration attribute:

Example of suffixing the applicationId for each buildType:

defaultConfig {
    applicationId "com.package.android"
    minSdkVersion 17
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}

buildTypes {
    release {
        debuggable false      
    }

    development {
        debuggable true
        applicationIdSuffix ".dev"
    }

    testing {
        debuggable true
        applicationIdSuffix ".qa"
    }
}
click below button to copy code from our android learning website - android tutorial - team

Our resulting applicationIds would now be:

  • com.package.android for release
  • com.package.android.dev for development
  • com.package.android.qa for testing

This can be done for productFlavors as well:

productFlavors {
    free {
        applicationIdSuffix ".free"
    }
    paid {
        applicationIdSuffix ".paid"
    }
}
click below button to copy code from our android learning website - android tutorial - team

The resulting applicationIds would be:

  • com.package.android.free for the free flavor
  • com.package.android.paid for the paid flavor

Related Searches to Specifying different application IDs in Android