138

Is there a way to extract and view the content of an .apk file?

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
noob
  • 1,391
  • 2
  • 9
  • 6

14 Answers14

154

Actually the apk file is just a zip archive, so you can try to rename the file to theappname.apk.zip and extract it with any zip utility (e.g. 7zip).

The androidmanifest.xml file and the resources will be extracted and can be viewed whereas the source code is not in the package - just the compiled .dex file ("Dalvik Executable")

DonGru
  • 13,532
  • 8
  • 45
  • 55
  • The dalvik file can be converted to jar using dex2jar utility and then can be opened by any java decompiler tool. – Nikhil Jain May 15 '21 at 09:58
50

It's shipped with Android Studio now. Just go to Build/Analyze APK... then select your APK :)

enter image description here

TienLuong
  • 1,065
  • 1
  • 10
  • 7
22

While unzipping will reveal the resources, the AndroidManifest.xml will be encoded. apktool can – among lots of other things – also decode this file.

To decode the application App.apk into the folder App, run

apktool decode App.apk App

apktool is not included in the official Android SDK, but available using most packet repositories.

Kirk
  • 517
  • 3
  • 14
Jens Erat
  • 37,523
  • 16
  • 80
  • 96
  • 2
    You have to add `-o` to the command, otherwise, it thinks `App` is an input file, reporting the error: "Input file (App) was not found or was not readable". Proper command: `apktool decode App.apk -o App`. – Mr. Goldberg Nov 18 '20 at 13:02
12

There is also zzos. (Full disclosure: I wrote it). It only decompiles the actual resources, not the dex part (baksmali, which I did not write, does an excellent job of handling that part).

Zzos is much less known than apktool, but there are some APKs that are better handled by it (and vice versa - more on that later). Mostly, APKs containing custom resource types (not modifiers) were not handled by apktool the last time I checked, and are handled by zzos. There are also some cases with escaping that zzos handles better.

On the negative side of things, zzos (current version) requires a few support tools to install. It is written in perl (as opposed to APKTool, which is written in Java), and uses aapt for the actual decompilation. It also does not decompile attrib resources yet (which APKTool does).

The meaning of the name is "aapt", Android's resource compiler, shifted down one letter.

quetzalcoatl
  • 32,194
  • 8
  • 68
  • 107
Shachar Shemesh
  • 8,193
  • 6
  • 25
  • 57
9

You have several tools available:

  • Aapt (which is part of the Android SDK)

    $ aapt dump badging MyApk.apk
    $ aapt dump permissions MyApk.apk
    $ aapt dump xmltree MyApk.apk
    
  • Apktool

    $ java -jar apktool.jar -q decode -f MyApk.apk -o myOutputDir
    
  • Android Multitool

  • Apk Viewer

  • ApkShellext

  • Dex2Jar

    $ dex2jar/d2j-dex2jar.sh -f MyApk.apk -o myOutputDir/MyApk.jar
    
  • NinjaDroid

    $ ninjadroid MyApk.apk
    $ ninjadroid MyApk.apk --all --extract myOutputDir/
    
  • AXMLParser

    $ apkinfo MyApk.apk
    
Paolo Rovelli
  • 9,396
  • 2
  • 58
  • 37
skan
  • 7,423
  • 14
  • 59
  • 96
8

unzip my.apk

This does the trick from the Linux command line since the APK format is just a ZIP file on the top.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
8

4 suggested ways to open apk files:

1.open apk file by Android Studio (For Photo,java code and analyze size) the best way

enter image description here

2.open by applications winRar,7zip,etc (Just to see photos and ...)

3.use website javadecompilers (For Photo and java code)

4.use APK Tools (For Photo and java code)

Rasoul Miri
  • 11,234
  • 1
  • 68
  • 78
3

There is a online decompiler for android apks

http://www.decompileandroid.com/

Upload apk from local machine

Wait some moments

download source code in zip format.

Unzip it, you can view all resources correctly but all java files are not correctly decompiled.

For full detail visit this answer

Community
  • 1
  • 1
Zar E Ahmer
  • 33,936
  • 20
  • 234
  • 300
3

In case of Hybrid apps developed using cordova and angularjs, you can:

1) Rename the .apk file to .zip
2) Extract/Unzip the contents
3) In the assets folder you will get the www folder

Kailas
  • 7,350
  • 3
  • 47
  • 63
2

Depending on your reason for wanting to extract the APK, APK Analyzer might be sufficient. It shows you directories, and file sizes. It also shows method counts grouped by package that you can drill down into.

APK Analyzer is built into Android Studio. You can access it from the top menu, Build -> Analyze APK.

eliasbagley
  • 1,237
  • 9
  • 17
1

You can also use Jadx - https://github.com/skylot/jadx. I have used all the tools mentioned in this page and found that Jadx works the best. The manifest file and other class files are converted to readable format as much as possible by this tool.

PS - http://www.javadecompilers.com/apk also uses the jadx decompiler to do the same work online. Simpler if you want to unarchive a single apk.

Cheers!

Monal Jain
  • 36
  • 1
  • 4
1

The APK Scanner can be show the information of APK file on PC.
also, can be pull an apk file from the android device.
And can be link to other tools.(JADX-GUI, JD-GUI...)

enter image description here

0

You can also see the contents of an APK file within the Android device itself, which helps a lot in debugging.

All files including the manifest of an app can be viewed and also shared using email, cloud etc., no rooting required. App is available from:

https://play.google.com/store/apps/details?id=com.dasmic.android.apkpeek

Disclaimer: I am the author of this app.

cbelwal
  • 379
  • 2
  • 7
0

I opened it with peazip after I couldn't rename file extension.