How to get version of internal link library from apk

I created apk using maven + eclipse .

This is a single file and contains internal links to libraries given by mvn dependencies . Everything works fine on my android, but I need to display in runtime version of referenced libs . I know how to display the version of my application (from androidManifest.xml), but the problem is to get the version of another used library , which is somehow included in my apk.

Inside apk, I don’t see my referenced bans, I believe this is done by class.dex .

I found a way to get the version from jar lib, but this does not work for apk.

Can I find the version of the internal reference library in run-time?

+6
source share
1 answer

Let me rephrase your question. You have developed a mobile application that uses a third-party library, and your goal is to find a version of this third-party library from the APK. If I understood correctly, then recently I came across a similar requirement. First, a third party manifest will have version information. When you created the APK, this manifest information, which contains version information, will not be merged with the AndroidManifest APK file. The AndroidManifest schema does not seem to provide this facility. In our case, we are sending the library, so one possible solution is that we can possibly add version information to the metadata element inside the activity element in the Android library manifest file so that apk, when it is created, will copy the activity element from the library android appears in the android android manifest. In this way, we can transfer this library version information to the main Android APK manifest. Perhaps we can make a request to change the Android manifest schema to provide the ability to include version information for the internal library. Check out the following link. https://developer.android.com/guide/topics/manifest/manifest-element.html

Another solution would be to use jarsigner to insert a custom record (containing version information of a third-party library into the APK manifest file after building the APK). That again is not a standard solution.

0
source

All Articles