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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…