Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get version of referenced internal library from apk

I've created apk by maven + eclipse.

It is a single file and has internal references to libraries given by mvn dependencies. On my android everything works great, but I need to display in runtime version of referenced libs. I know how to display version of my application (from androidManifest.xml), but the problem is to get version of other used library, which in some way is included to my apk.

Inside apk I don't see my referenced jars, I suppose it is made by class.dex.

I found the way to get version from jar lib, but it doesn't work for apk.

Can we found version of internal reference library at run-time?

like image 967
chaqol Avatar asked Jan 04 '13 14:01

chaqol


1 Answers

Let me rephrase your question. You have developed a mobile app which uses third party library and your goal is to find the version of that third party library from APK. If i have understood it correctly, then i faced a similar requirement recently. Firstly the third party jar's manifest will have version information. When you built APK this manifest info that contains the version info wont be merged with APK's AndroidManifest file. AndroidManifest schema does not seem to provide this facility. In our case we ship the library ,so one probable solution is that we can probably add the version info into metadata element inside activity element in Android Manifest file of the library so that apk when it is built it will copy the activity element from the library's android manifest to the app's android manifest.This way we can pass that version info of a library to main APK's Android Manifest. May be we can make a request to modify the schema of Android manifest to give provision to include version info of internal library. Please check the following link. https://developer.android.com/guide/topics/manifest/manifest-element.html

The other solution could be one can possibly use jarsigner to insert custom entry (that contains info on version of third party library into APK's manifest file after building APK. Thats again not a standard solution.

like image 101
Kaarthikraaj Ramanan Avatar answered Oct 07 '22 19:10

Kaarthikraaj Ramanan