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
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.
Once the above command is done. Sign the APK with your keystore file as shown in the below example.
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.
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.