You can specify different application IDs or package names for each buildType or [productFlavor](<http://stackoverflow.com/documentation/android/95/gradle-for-android/401/defining-product-flavors#t=201608040613545973062>) 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"
    }
}

Our resulting applicationIds would now be:

This can be done for productFlavors as well:

productFlavors {
    free {
        applicationIdSuffix ".free"
    }
    paid {
        applicationIdSuffix ".paid"
    }
}

The resulting applicationIds would be: