set applicationIdSuffix depending on productFlavor

拟墨画扇 提交于 2019-12-22 06:58:46

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/29297934/set-applicationidsuffix-depending-on-productflavor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!