Skip to content

Instantly share code, notes, and snippets.

@optozorax
Created May 9, 2022 19:17
Show Gist options
  • Save optozorax/d2ae45f1f88e79f012d828a59aabae4d to your computer and use it in GitHub Desktop.
Save optozorax/d2ae45f1f88e79f012d828a59aabae4d to your computer and use it in GitHub Desktop.
Rename package in apk

Tutorial

You have apk oldapk.apk, you want to rename its package from com.oldcompany.oldname to com.mycompany.myname.

  1. Install:
  1. Unzip apk: apktool d oldapk.apk

  2. Edit oldapk/apktool.yml:

-  renameManifestPackage: null
+  renameManifestPackage: com.mycompany.myname
  1. Replace old names to new:
ruplacer "Lcom/oldcompany/oldname" "Lcom/mycompany/myname"
ruplacer "com\.oldcompany\.oldname" "com.mycompany.myname"
  1. Rename folders smali/com/oldcompany/oldname to smali/com/mycompany/myname. You can check folders that has old name by using find | grep oldcompany and find | grep oldname.

  2. (Optional) Change app name: ruplacer "Old name" "New name"

  3. Compress apk: apktool b oldapk -o newapk.apk

  4. Sign apk: signapk SignApk/certificate.pem SignApk/key.pk8 newapk.apk newapksigned.apk

See also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment