Gangmax Blog

自由之思想,独立之精神

Get Original APK File from Android

The is a method to get the original apk file after you installed it on an Android phone before. From here and here.

1
2
3
4
5
6
7
8
9
10
# 1. Install the following android related packages on Ubuntu.
sudo apt-get install android-tools-adb android-tools-fastboot

# 2. Open the "Developer Mode" of your Android phone, connect your phone
# to your computer. Run the following commands:
> adb devices
> adb start-server
> adb shell pm list package
> adb shell pm path me.huanggang.android.dof
> adb pull /data/app/me.huanggang.android.dof-1.apk

Here is an example to do the same thing on Mac OS X.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 1. Install "android-platform-tools" on Mac via Homebrew.
brew cask info android-platform-tools

# 2. Open the "Developer Mode" of your Android phone, connect your phone
# to your computer. Run the following commands:
> adb start-server
> adb devices
# Note that: running the following command, you may be prompted
# on the phone that whether trusts the current computer to debug,
# you need to accept it before going forward.
> adb shell pm list package
> adb shell pm list package | grep 'shadow'
package:com.github.shadowsocks
package:in.zhaoj.shadowsocksr
> adb shell pm path in.zhaoj.shadowsocksr
package:/data/app/in.zhaoj.shadowsocksr-dO9P4GsOB9jrk3HFzJws8A==/base.apk
> adb pull /data/app/in.zhaoj.shadowsocksr-dO9P4GsOB9jrk3HFzJws8A==/base.apk
/data/app/in.zhaoj.shadowsocksr-dO9P4GsOB9jrk3HFzJws8A==/base.apk: 1 file pulled. 10.2 MB/s (3703111 bytes in 0.345s)
> mv base.apk shadowsocksr.apk

Comments