I created 2 projects 1 - Lib and 2nd in Test. From the test application, I pass the context to the Lib project.
Since I have context in Lib, I used below code inside Lib
String version = this.mContext.getPackageManager (). getPackageInfo (this.mContext.getPackageName (), 0) .versionName; Log.e ("versionName", version);
But this gives me the name of the test application version, not lib. How do I get the name and version code for Lib?
Link Link: How to get information about the version of the built-in library?
morya source share