How to clone an Android app?

Android will not allow any app to be installed more than one instance. Because each app is identified by its unique package identifier which can’t be duplicated under any circumstances. When you install an apk again, your previously installed app with the same package id will get overwritten. So, how to make a clone that can coexist with its original version? The following simple steps will help you to achieve this.

Download the APK file

Download the build from Google Play using any online APK downloader.

Decompile the build using apktool

Modify the app package

Open the decompiled folder on any editor. I used Visual Studio Code. Here, all you need to do is change the package identifier and rearrange the resources according to the new package name. For example, I have downloaded Sudoku app and it’s original package is com.easybrain.sudoku.android and I wanted to change it to com.easybrain.sudoku1.android. Always prefer to change the right most subfolder name on the package. So that, the number of files that are going to be affected will be comparatively less. 

Original Package: com.easybrain.sudoku.android

Target Package: com.easybrain.sudoku1.android

Rename the sub-folders

Search for the /com/easybrain/sudoku under smali folder and rename it as com/easybrain/sudoku1. If the app is multidex enabled, then there can be other smali folders called smali_classes(N). Rename the subfolder if found under these folders too.

Find and replace the package name in decompiled resources

1. Class References
Lcom/easybrain/sudoku =>Lcom/easybrain/sudoku1

The old package name has to be replaced with new one. The best way to do this is use the Search & Replace feature of your editor. Do not forget to select the entire decompiled folder for search and click Replace All option. If the occurrences of package reference is huge, you may need to repeat Search & Replace process until no old package name is found in the project.

2. Static Strings
com.easybrain.sudoku.android => com.easybrain.sudoku1.android

You also need to replace package strings as shown below. This will update the new package name wherever it's referred as String.

Rebuild and sign the app

You are all good to rebuild the APK with new package name. Following is the command to regenerate the Android build from the modded resources.

 apktool b Sudoku

Once the above command is done. Sign the APK with your keystore file as shown in the below example.

 jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore pp.keystore Sudoku/dist/Sudoku.apk Koel$@7

Install the clone

Once successfully signed, you can install the cloned APK along with it's original version. Since the package identifier is different, the cloned APK will be treated as new app.

Screencast

PS: There is no guarantee the cloned app created with the above steps will successfully work though it can be installed on the device. There are lots ways to programmatically restrict the app from being cloned in this way. You need to investigate the code if something is not working in the cloned app.