Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set applicationIdSuffix depending on productFlavor

We have 2 productFlavors (testServer, liveServer) and 2 build types (debug, release).

Due to existing API keys, I have to append package names based on buildType + productFlavor.

For example something like:

buildTypes {
  debug {
   applicationIdSuffix '.dbg' + (testServer ? '.test' : '.live')
  }

  release {
   applicationidSuffix '' + (testServer ? '.test')
  }  
}

is this possible? how?

like image 266
Nima G Avatar asked Mar 27 '15 10:03

Nima G


1 Answers

productFlavors {
    testServer {
        applicationId = "com.example.my.pkg.test"
    }
    liveServer {
        applicationId = "com.example.my.pkg.live"
    }
}

buildTypes {
    debug {
        applicationIdSuffix ".debug"
    }
}

For more information, take a look at the Android documentation regarding application ids.

like image 102
Mark Vieira Avatar answered Sep 20 '22 16:09

Mark Vieira