Alex
Alex

Reputation: 1349

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

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

Upvotes: 22

Views: 49474

Answers (4)

Håvard Geithus
Håvard Geithus

Reputation: 5624

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 ;)

Upvotes: 23

Paul Kavanagh
Paul Kavanagh

Reputation: 1161

$ aapt dump badging <path-to-apk>

Upvotes: 102

CommonsWare
CommonsWare

Reputation: 1007369

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).

Upvotes: 2

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.

Upvotes: 8

Related Questions