Fully change package name including company domain

后端 未结 16 2465
礼貌的吻别
礼貌的吻别 2020-12-13 01:11

Let\'s suppose this is the package name: package com.company.name. How do I change company?

P.S. I saw how to change name but

16条回答
  •  死守一世寂寞
    2020-12-13 02:09

    current package : com.company.name

    New package : com.mycomapny.name

    Steps: 1) Suppose you are at this screen which is shown below.

    2) Open project pane and click on settings icon.

    3) Deselect Compact Empty Middle Packages.

    4) Then your package is now broken into individual parts as shown below .

    5) right click on "company" select Refactor -> select rename ->rename directory.

    6) Now your "company" has been changed to new "mycomapny" and changes were reflected as shown in below figure.

    7) Now change the package name in AndroidManifest.xml file .

    8) Open app level build.gradle and change package name .

    9) you will get errors as Cannot resolve symbol "R" .

    10) Remove line which gives this error and studio will import new R file automatically.

    11) If you have multiple files then use find and replace option by pressing " Cntrl+Shift+R "

    Or " Select Edit->Find->Replace in path.."

    12) select Replace All.

提交回复
热议问题