Tech Blog

Testing

How to change package name of any apk file using apktool

By Hiten Desai4 min read
← Back to blog

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.

Keep reading

You may be interested in

Browse all articles →
Software Testing: Challenges and Solutions
February 8, 20244 min read

Software Testing: Challenges and Solutions

Introduction – Testing software is a crucial aspect of the development process. It makes sure that the product’s functionality works as expected, fulfills the user requirements, and makes sure it works without errors. In this blog, we will list down some of the most common challenges faced in software testing and conclude with how to […]

By Saboor ChandshahaRead More →
Streamlining Software Quality: The Power of Automating Black Box Testing
February 8, 20244 min read

Streamlining Software Quality: The Power of Automating Black Box Testing

Introduction :  In the dynamic realm of software development, ensuring the robustness and reliability of applications is of paramount importance. Black box testing, a technique that assesses software functionality without requiring knowledge of its internal code, plays a vital role in identifying potential defects. As the complexity of software systems continues to escalate, the manual […]

By Anthony Gilchrist G SRead More →
Implementing best practices for end-to-end testing in cloud migration
January 31, 20245 min read

Implementing best practices for end-to-end testing in cloud migration

Importance of End-to-End Testing Assume an organization’s core systems are now hosted on the cloud—a complex ecosystem linked by data threads. End-to-end testing is the foundation upon which the reliability and performance of this interconnected web is built. This rigorous testing technique makes it possible to detect vulnerabilities, optimize operations, and improve user experience. Active […]

By Rahul ChakravartiRead More →