Android Studio 2024(Koala) - (Rename package from A.B.Name to A.B.C.Name)
Things changed slightly between versions - so this will probably only be relevant for Android Studio - Koala
Make a complete backup of your project as it is (I tried multiple times before finding a working solution)
Create a new package in the main folder with the name you would like to use: (Convention is to use your website address in reverse)

Select the main directory for your new package:

- Type your new package name and press enter.

- Select the contents of your existing package and drag it to the new one:

- Confirm the move:

- If you have multiple folders, after the move it might come up with the same move window again and selecting ok might show an error. Just close this window.

- Next delete the old package (the old package should be empty by now)

- Next select the top folder of the project

- Click on Edit->Find->Replace in Files

- Type your old package name at the top (you might need to use escape characters), your new package name and then select replace all

- Clean your build next

- Invalidate the cache and restart


- Finally if you are using a development device, delete the previous installation from the old device before running debug again.