79144097

Date: 2024-10-31 09:21:56
Score: 1
Natty:
Report link

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

  1. Make a complete backup of your project as it is (I tried multiple times before finding a working solution)

  2. 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) Add your new package

  3. Select the main directory for your new package:

Pick main directory

  1. Type your new package name and press enter.

Enter new package name

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

Drag existing contents to new package

  1. Confirm the move:

Confirm the move

  1. 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.

Close move window

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

Delete old package

  1. Next select the top folder of the project

Select top folder

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

Find and replace

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

Replace old package name

  1. Clean your build next

Clean project build

  1. Invalidate the cache and restart

Invalidate cache

Invalidate and restart

  1. Finally if you are using a development device, delete the previous installation from the old device before running debug again.
Reasons:
  • Probably link only (1):
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Assay