Is it possible to change the company domain name in android studio after creating the project?

后端 未结 1 1127
轻奢々
轻奢々 2021-02-20 07:57

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 p

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-20 08:41

    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.

    0 讨论(0)
提交回复
热议问题