ax / apk.sh

apk.sh makes reverse engineering Android apps easier, automating some repetitive tasks like pulling, decoding, rebuilding and patching an APK.
GNU General Public License v3.0
3.34k stars 189 forks source link

[BUG] cannot pull latest instagram apk #14

Closed hisa13 closed 1 year ago

hisa13 commented 1 year ago

Information

  1. apk.sh version : 1.0.4
  2. Operating System (Mac, Linux, Windows) : MacOS Ventura 13.4
  3. APK From? (Playstore, ROM, Other) : Playstore
  4. Device : Pixel 3a (Android 12)

apk.sh output

❯❯❯ ./apk.sh pull com.instagram.android
[*] apk.sh v1.0.4
[*] home dir is /Users/{username}/.apk.sh
[*] apktool v2.7.0 exist in /Users/{username}/.apk.sh
[*] apksigner v0.9 exist in /Users/{username}/.apk.sh/sdk_root/build-tools/33.0.1
[*] zipalign exist in /Users/{username}/.apk.sh/sdk_root/build-tools/33.0.1
[*] aapt exist in /Users/{username}/.apk.sh/sdk_root/build-tools/33.0.1
[>] Pulling com.instagram.android: Split apks detected!
[>] Pulling 3 apks in ./com.instagram.android_split_apks/
/data/app/~~cj7mY3z04tmehXjM5xUimQ==/com.instagram.android-kudgMUtbD5bmhF...=/base.apk: 1 file pulled, 0 skipped. 6.3 MB/s (53360636 bytes in 8.056s)
/data/app/~~cj7mY3z04tmehXjM5xUimQ==/com.instagram.android-kudgMUtbD5bmhF...mentation.apk: 1 file pulled, 0 skipped. 5.9 MB/s (74291 bytes in 0.012s)
/data/app/~~cj7mY3z04tmehXjM5xUimQ==/com.instagram.android-kudgMUtbD5bmhF...pytorch.apk: 1 file pulled, 0 skipped. 4.7 MB/s (2072985 bytes in 0.416s)
[>] Combining split APKs into a single APK...
[>] Decoding com.instagram.android_split_apks/base.apk with java -jar /Users/{username}/.apk.sh/apktool_2.7.0.jar d com.instagram.android_split_apks/base.apk -o com.instagram.android_split_apks/base 1>/dev/null
[>] Done!
[>] Decoding com.instagram.android_split_apks/split_arservicesforpersonsegmentation.apk with java -jar /Users/{username}/.apk.sh/apktool_2.7.0.jar d com.instagram.android_split_apks/split_arservicesforpersonsegmentation.apk -o com.instagram.android_split_apks/split_arservicesforpersonsegmentation 1>/dev/null
W: Could not decode attr value, using undecoded value instead: ns=dist, name=title, value=0x7f020000
[>] Done!
[>] Decoding com.instagram.android_split_apks/split_pytorch.apk with java -jar /Users/{username}/.apk.sh/apktool_2.7.0.jar d com.instagram.android_split_apks/split_pytorch.apk -o com.instagram.android_split_apks/split_pytorch 1>/dev/null
W: Could not decode attr value, using undecoded value instead: ns=dist, name=title, value=0x7f020000
[>] Done!
[>] Walking extracted APKs dirs and copying files to the base APK...
[>] Fixing APKTOOL_DUMMY public resource identifiers...
[>] Done!
[>] Disabling APK splitting (isSplitRequired=false) if it was set to true...
sed: 1: "com.instagram.android_s ...": command c expects \ followed by text
[>] Done!
[>] Enabling native libraries extraction if it was set to false...
sed: 1: "com.instagram.android_s ...": command c expects \ followed by text
[>] Done!
[>] Building with java -jar /Users/{username}/.apk.sh/apktool_2.7.0.jar b -d  com.instagram.android_split_apks/base -o file.single.apk --use-aapt2
I: Using Apktool 2.7.0
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes10 folder into classes10.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes9 folder into classes9.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes7 folder into classes7.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes6 folder into classes6.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes8 folder into classes8.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes3 folder into classes3.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes4 folder into classes4.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes5 folder into classes5.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
I: Checking whether resources has changed...
I: Building resources...
I: Using aapt2 - setting 'debuggable' attribute to 'true' in AndroidManifest.xml
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values-h640dp/layouts.xml:3: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values-h640dp/layouts.xml: error: file failed to compile.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values-land/layouts.xml:3: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values-land/layouts.xml:4: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values-land/layouts.xml:5: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values-land/layouts.xml: error: file failed to compile.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values-sw600dp/layouts.xml:3: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values-sw600dp/layouts.xml:4: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values-sw600dp/layouts.xml: error: file failed to compile.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values/layouts.xml:3: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values/layouts.xml:4: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values/layouts.xml:5: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values/layouts.xml:6: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values/layouts.xml:7: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values/layouts.xml:8: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values/layouts.xml:9: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values/layouts.xml:10: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values/layouts.xml:11: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values/layouts.xml:12: error: invalid value for type 'layout'. Expected a reference.
W: /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res/values/layouts.xml:13: error: invalid value for type 'layout'. Expected a reference.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/37/c55v40hd2pg0ycf01ryx3jn80000gn/T/brut_util_Jar_114820535807874165421544189346892466900.tmp, compile, --dir, /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/res, --legacy, -o, /Users/{username}/{working_dir}/apk.sh/com.instagram.android_split_apks/base/build/resources.zip]
[>] Sorry!
[!] java -jar /Users/{username}/.apk.sh/apktool_2.7.0.jar b -d  com.instagram.android_split_apks/base -o file.single.apk --use-aapt2  return errors!
[>] Bye!
zsh: exit 1     ./apk.sh pull com.instagram.android

Steps to Reproduce

  1. adb connect android device (target app installed)
  2. ./apk.sh pull com.instagram.android

APK

Instagram v286.0.0.20.69 arm64 v8a (installed from playstore)

Questions to ask before submission

Are you using the latest apk.sh version? yes

hisa13 commented 1 year ago

I could solve this problem with editing script like below

https://github.com/ax/apk.sh/blob/7679045351d0780f2d342e2819505e0dc5277a5a/apk.sh#L173

-       DECODE_CMD_START="java -jar $APKTOOL_PATH d"
+       DECODE_CMD_START="java -jar $APKTOOL_PATH d -f -r"