How to get the build variant at runtime in Android Studio?

前端 未结 5 1099
别那么骄傲
别那么骄傲 2020-12-02 22:00

I\'d like to get the build variant during runtime, is this possible without any extra config or code?

5条回答
  •  臣服心动
    2020-12-02 22:19

    If you are already flavoring then no need to provide extra string field in your gradle. Just follow simple steps to get the build details:

    For build variant : BuildConfig.FLAVOR
    For build version code : BuildConfig.VERSION_CODE
    For build version name : BuildConfig.VERSION_NAME

提交回复
热议问题