Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fully change package name including company domain

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 not company. I'm using Android Studio.

like image 470
Filip Luchianenco Avatar asked Sep 01 '13 11:09

Filip Luchianenco


People also ask

Can you change a package name?

In the Pop-up dialog, click on Rename Package instead of Rename Directory. Enter the new name and hit Refactor. Click Do Refactor in the bottom. Allow a minute to let Android Studio update all changes.

Can I change Android package name?

Step 1: To rename package name in Android studio open your project in Android mode first as shown in the below image. Step 2: Now click on the setting gear icon and deselect Compact Middle Packages. Step 3: Now the packages folder is broken into parts as shown in the below image.

How do I change the package name on an existing flutter project?

Steps to change package name manually for Androidxml file under the android>app> src>debug and android>app> src>profile. Step 2: Open the android>app> build. gradle file. Find the defaultConfig section and update the applicationId to the new package name.


2 Answers

current package : com.company.name

New package : com.mycomapny.name

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

enter image description here

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.

enter image description here

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

enter image description here

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

enter image description here

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

enter image description here

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

enter image description here

12) select Replace All.

like image 116
Janardhan R Avatar answered Oct 18 '22 22:10

Janardhan R


You can do this:

Change the package name manually in the manifest file. Click on your R.java class and the press F6 (Refactor->Move...). It will allow you to move the class to other package, and all references to that class will be updated.

reference: How do I rename the android package name?

like image 26
Luch Filip Avatar answered Oct 18 '22 20:10

Luch Filip