I am creating an AAR
library, In the arr manifest
we have version
name, and version code. How can I get this version. I don't want the main app version. I just want the library version.
Is there a way to get this version?
I am creating an AAR
library, In the arr manifest
we have version
name, and version code. How can I get this version. I don't want the main app version. I just want the library version.
Is there a way to get this version?
Step #1: Define those values as resources.
Step #2: Adjust your manifest to reference those resources.
Step #3: Refer to those values from the rest of your app via those resources.
I just tested this answer on our AAR libraries and it is working fine to get the versionName and versionCode defined in the build.gradle of your AAR lib. It appears to be the easiest solution. Basically:
Use String libVersionName = your.lib.package.name.BuildConfig.VERSION_NAME;
or in your library, just use BuildConfig.VERSION_NAME
to get it.
For versionCode, use: int libVersionCode = your.lib.package.name.BuildConfig.VERSION_CODE;