I have an android apk and I deleted my source code and dont have the project again, I want to change the version code of the old apk. my question is how do I unzip and repack the apk so I can use the. am using a mac system. I saw so many things for windows but i couldnt find for mac.I need help please
3 Answers
unzip apk files
The simplest method is executing unzip command:
unzip xxx.apk -d xxx
A directory xxx will be generated to store unzipped files.
Actually, .apk files are same as .zip files. Execute command file XXX.apk
to see that.
get readable text files from apk
If you want readable text files such as the manifest file, I would suggest you to use the apktool. We could install the apktool easily with Homebrew:
brew install apktool
then get the readable text files:
apktool d xxx.apk
after the previous command, a xxx directory contains readable text files and others would be there.
edit zip files
If you want to edit a zip file in place, the Keka might be a good option.

- 2,063
- 2
- 10
- 14
-
3this should be the acceptable answer, no need to download any app or tool. – vishwa.deepak Jul 21 '17 at 08:49
-
4However AndroidManifest.xml looks like garbled text. – Gqqnbig May 20 '19 at 21:50
-
I agree this should be marked as the accepted answer, thanks Liu Tao! – Michael Sep 15 '20 at 16:35
-
in windows this command is not recognized? – showtime Oct 22 '22 at 20:58
-
@dontdownvoteme windows doesn't support the command, but you could modify the apk extension as zip, and then use some other tool to unzip it. – Liu Tao Oct 24 '22 at 06:51
To give a complete answer for unpacking, editing and packing on Mac:
Unpacking / Unzipping
As Liu Tao stated, the easiest way to unpack a *.apk file on mac is to use the following command:
unzip xxx.apk -d xxx
This is because an *.apk file is nothing else than a zip file. Again, as Liu Tao stated, this can be found out with the file command.
file xxx.apk
Which will show an output that looks something like this:
xxx.apk: Zip archive data, at least v2.0 to extract
Editing
I think this is self-explanatory. Go into the folder to which you exported the *.apk contents and edit them as you would usually do.
Packing / Zipping
On Mac, this is also quite straight-forward. You can use the zip command to pack all the files back into an *.apk file.
zip -r xxx.apk xxx/

- 30,049
- 21
- 112
- 147

- 540
- 6
- 9
-
I'm afraid it doesn't look like this works anymore (at least not when trying to install on the emulator). Logcat is showing a `java.io.FileNotFoundException: AndroidManifest.xml` despite the file existing in the new APK – foxtrotuniform6969 Jun 06 '20 at 04:21
-
I have been trying to achieve this, on windows, I have been unable to do it. I have tried several zip tools: powershell unzip/zip commands, 7zip, C# zip libraries: System.IO.Compression.ZipFile, SharpZipLib, SharpCompress, DotNetZip. Any help would be extra recontra gratefuled. – Carlos Iglesias Sep 19 '21 at 16:33
You want to use APKTool. It will handle the unzip and rebuild for you: http://ibotpeaches.github.io/Apktool/

- 413
- 4
- 18
-
1You can also use a tool like jdgui to get a semblance of your source code back. http://jd.benow.ca – Blackdragon1400 Apr 09 '15 at 13:54
-
-
1Not working for me. After generating apk file android says: There is problem parsing the package – Khalil Laleh Oct 16 '17 at 22:24
-
Man I hate the Java runtime: Error: Could not find or load main class version – zezba9000 Jun 18 '20 at 23:03