It can be done very easily in one step.
You don't have to touch AndroidManifest.
Instead do the following:
- right click on the root folder of your project.
- Click "Open Module Setting".
- Go to the Flavours tab.
- Change the applicationID to whatever package name you want. Press OK.