How to change package name of any apk file using apktool


In this blog I will guide you how to rename the package name of any apk file. Usually this type of thing is needed when apk is related to any enterprise level feature where you want to give the same apk for different kinds of manufacture for signing purposes, or might be required for any other scenarios where you need to change the package name of the same apk for different purposes.

You can do such a thing using a preferred IDE as well (like Android Studio, Eclips, IntelIiJ IDEA, ect.) but for that you need basic programming knowledge and doing the same will need some time also for generating a new apk with new package name. But you can do the same without any programming knowledge and with minimal time using apktool.

To know more about what is apktool, you can refer below link

https://ibotpeaches.github.io/Apktool/

To install and configure apktool, you can refer steps from below official link

https://ibotpeaches.github.io/Apktool/install/

After successful configuration you can refer below process to rename package name of apk file.

  • You can create one folder at a specific location where you want to decompile source files of the apk. Say suppose I am creating folder with name as DecompiledAPK
  • Open command line interface(CLI) from that specific location. Steps can be different for different OS. Refer below screenshot for mac where I have created DecompileAPK inside the Library folder (you can use any folder), and navigate to that folder
  • Now, use apktool d (apk-path) command as per below screenshot, which will generate some files inside the DecompileAPK folder. My current apk file path is inside the download folder.
  • After compilation of the decompilation process you will see some files inside the application name folder. My app name is dummyAPK so decompiled source code will be present inside DecompileAPK -> dummyAPK. You will see some files like the screenshot below. File count can be changed as per functionality inside the apk you are decompiling.
  • Now, you have to replace the new package name at 2 places. Inside AndroidManifest.xml file and inside apktool.yml folder. 
  • Inside AndroidManifest.xml you will see package value at the first or second line. Refer screenshot below where package value is com.dummyapk which is the actual package name of the current apk. 
  • Now replace the actual package name with the target package name. Say suppose I want an apk with com.tempapk package name. So just change the value of the package to com.tempapk as per below screenshot. Make sure to save the changes after making a change in package name. No need to change anything else.
  • Another change we have to do is inside the apktool.yml file. Open the file and look for renameManifestPackage. You will find null as a value. Refere screenshot below
  • Just change the renameManifestPackage’s value to the same value as com.tempapk(your target package name) and save the changes. Refer below screenshot for the same
  • Now, at the same location where you are inside CLI, execute the command as apktool b (decompiled-folder). In my case the decompiled folder name is dummyAPK. Refer below screenshot for the same. 
  • Once after a successful process you will see some new files inside the dummyAPK folder shown in the below screenshot. But to collect the apk file you have to see inside the dist folder. You will see a new apk with the same name (dummyAPK) but the package name of that apk is target package name as com.tempapk rather than com.dummyapk. To verify the same you can use any platform which you are using to check the package name of the application. 

That’s all to rename the package name of any application which you want. You can now share this new apk to respected people for further use.

Leave A Comment

Your email address will not be published. Required fields are marked *