Is it possible to get any information about the package or the application from the apk file without installing it in the Android environment?
4 Answers
$ aapt dump badging <path-to-apk>

- 1,141
- 1
- 7
- 5
-
5This answers the question perfectly. – Tigger Jan 24 '14 at 05:26
-
How did you discover this? – Hola Soy Edu Feliz Navidad Jan 23 '20 at 10:17
-
1If you don't have this command in your path add this to ~/.bash_profile: `export PATH=${PATH}:$ANDROID_HOME/build-tools/
` (X.X.X being your build tools version) – Andy M Jun 10 '20 at 14:09
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 ;)

- 22,187
- 7
- 70
- 94

- 5,544
- 7
- 36
- 51
-
Thanks for an answer - I'll check it out. But currently I need the same functionality on server side, so this is not an option for me. – Alex Aug 11 '11 at 07:42
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.

- 2,659
- 2
- 21
- 26
-
5I am looking for something similiar to PackageManager.getPackageInfo (http://developer.android.com/reference/android/content/pm/PackageManager.html#getPackageInfo%28java.lang.String,%20int%29) but for the apk file. I need this for my android app, so unzipping and converting AndroidManifest.xml from binary form isn't the best way (IMHO). – Alex Dec 17 '10 at 12:15
-
7every xml file is in binary or something looks like this 0300 0800 e808 0000 0100 1c00 b401 0000 1800 0000 0000 0000 0001 0000 7c00 0000 – AlThePal78 Sep 11 '15 at 17:16
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).

- 986,068
- 189
- 2,389
- 2,491
-
Sam, CommonsWare - thanx for the answers. The last four hours ensured me that I have no other options so i have two more questions: 1. What's the easiest way to unzip file in android? 2. How can I convert AndroidManifest.xml from axml to the xml? – Alex Dec 17 '10 at 12:31
-
http://stackoverflow.com/questions/2097813/how-to-parse-the-androidmanifest-xml-file-inside-an-apk-package – CommonsWare Dec 17 '10 at 13:05
-
Also http://android.modaco.com/content/t-mobile-pulse-pulse-modaco-com/304547/android-xml-decompiler/ – CommonsWare Dec 17 '10 at 13:07
-
Whell, i've done it)) I've ended withAXMLPrinter2 for parsing the AndroidManifest.xml (http://code.google.com/p/android4me/downloads/detail?name=AXMLPrinter2.zip&can=2&q=), extracted from apk. – Alex Dec 17 '10 at 14:55