How to get application or package info from the apk file in the android application in the Android environment-ThrowExceptions

Exception or error:

Is it possible to get any information about the package or the application from the apk file without installing it in the Android environment?

How to solve:

An apk file is really just a zip archive with a different name. Rename x.apk to x.zip, where x is the name of the file, and you will be able to open it with any zip tool. It really depends on what information you’re after as to whether you can find it in the apk file. I can say that you can access the AndroidManifest.xml file in which key information about the access rights of the app etc is stored in a fairly readable form, provided you know what you’re looking for. What do you want to find? If you’re looking for a readme or something then you almost certainly won’t find it in there.

###

$ aapt dump badging <path-to-apk>

###

Check out this method from the PackageManager class:

public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags)

Retrieve overall information about an application package defined in a package archive file

Might be helpful for you 😉

###

unzipping and converting AndroidManifest.xml from binary form isn’t the best way (IMHO)

You act like you have an option. You don’t, if all you have is the APK. The only solution, if all you have is the APK file, is based on what Sam pointed out.

Of course, you can publish your metadata in a separate file alongside your APK, wherever you are getting your APK from (e.g., Web server).

Leave a Reply

Your email address will not be published. Required fields are marked *