Get Android library module version number from inside demo app

前端 未结 2 1493
说谎
说谎 2021-02-20 06:00

I can programmatically get my app\'s version name like this:

String versionName = BuildConfig.VERSION_NAME; // 1.0

However, I have a demo app f

2条回答
  •  粉色の甜心
    2021-02-20 06:56

    Use
    String libVersionName = your.lib.package.name.BuildConfig.VERSION_NAME;

    or in your library, just use BuildConfig.VERSION_NAME to get it.


    NB:
    BuildConfig.VERSION_NAME in app module is your.app.package.name.BuildConfig.VERSION_NAME

提交回复
热议问题