14

When I created android project in android studio, I found field Company Domain Name .I have created with some name first. Now I want to change that company domain name. Is it possible to change? Please help me to solve this issue !

Mahendran Sakkarai
  • 8,381
  • 6
  • 44
  • 66
Vivek
  • 343
  • 1
  • 5
  • 12
  • do you mean the package name like com.example.app etc? – null pointer Oct 15 '15 at 05:55
  • Not the package name...while creating the project i found filed company domain name . – Vivek Oct 15 '15 at 06:47
  • It was because of [applicationId "android.com"] was missing the gradle file. – Vivek Mar 17 '16 at 18:35
  • Related posts - [Rename package in Android Studio](https://stackoverflow.com/q/16804093/465053) & [Fully change package name including company domain](https://stackoverflow.com/q/18558077/465053) – RBT Dec 19 '19 at 23:43

1 Answers1

29

You can able to change the domain using following steps. For your example you are trying to change the domain name com.example to com.example1. So your package name should look like com.example.application_name.

  1. Right click on the package name in the project explorer and then select Refactor -> Move.
  2. A new popup will ask you to what kind of refactor you need to do. In that select the first one Move package 'com.example.application_name' to another package. and then click ok.
  3. A new warning window will show that the package is in multiple places. Click yes on that warning.
  4. A new dialog will opened. In that, change the To package value to the new domain name com.example1 and then make sure the check box is enabled for Search in comments and String and Search for text occurrences and then click Refactor. Now a new dialog will open and ask a confirmation to create the new package. Click Yes.
  5. In the bottom window it ll search all the named com.example and ask you to refactor. Click Do Refactor in that. That's it. you renamed the domain name from com.example to com.example1. The previous package will not be deleted. if you don't want that means you can delete it.
Mahendran Sakkarai
  • 8,381
  • 6
  • 44
  • 66
  • 1
    Great work ...thank you..it works fine...once you have done this procedure..please follow this link to move further http://stackoverflow.com/questions/20915266/error-type-3-error-activity-class-does-not-exist – Vivek Oct 15 '15 at 08:42
  • 4
    @VivekE: if this answer solved your issue, please accept it. To do so, click the tick mark to the left of it so that it turns green. This is how we thank people on _Stack Overflow_. – halfer Jan 09 '16 at 10:55
  • This was easier than I feared it would be. I had accidentally named the package "example.com" instead of "com.example" which made me feel very silly. Maybe it doesn't matter, but it's nice to have it fixed. – Matt Payne Apr 29 '21 at 12:20