Editing manifest to change package name fails even after signing

Viewed 157

Messing around with an apk

  1. Renamed to ZIP
  2. Extracted the contents
  3. Deleted META-INF folder
  4. Replaced some music files in res/raw with other files with same name
  5. Zipped all the contents and renamed to APK
  6. Resigned APK with https://github.com/kellinwood/zip-signer/
  7. Installed the APK

Works as expected,the replaced music is played

But I also want to change package name so I modify the above process and added extra step 3B

  1. Renamed to ZIP
  2. Extracted the contents

3A. Deleted META-INF folder

3B. Edited the AndroidManifest.xml Changed value of package="com.mypkg"

  1. Replaced some music files in res/raw with other files with same name
  2. Zipped all the contents and renamed to APK
  3. Resigned APK with https://github.com/kellinwood/zip-signer/
  4. Installed the APK

But the newly signed apk with modified package name isn't recognised as APK by file explorers or package manager

Is is not possible to rename apk package name by this process when we can easily edit raw files?

1 Answers

How do you edit the AndroidManifest.xml?

The AndroidManifest.xml in the APK is not an XML file, it's a binary file compiled by aapt2, so if you replaced it with an actual XML file, it's effectively not a valid APK.

If you want to change the manifest of an APK, you may consider tools such as apktool, which allow to decompile the APK then recompile it after your changes.

Related