hakki
hakki

Reputation: 6517

How to Refactor R.java's package in Eclipse

I want to rename my Android project's package name. Under src/ folder refactoring of packages successful but if want to rename package under gen/ folder I can't do it. Because there is R.java file there. It is recreating automatically itself. If I disable this issue from Project -> Build Automaticall option then I see new problems with other java files.

Shortly

How can I rename my package name in Eclipse correctly and without error?

Upvotes: 1

Views: 2375

Answers (4)

Ishara Amarasekera
Ishara Amarasekera

Reputation: 1449

Please follow the steps given below to rename packages in the gen folder.

  1. Right click on the package under gen folder

  2. Select Refactor

  3. Select Rename

  4. Now change your package name as you wish

  5. Make sure you check the following options when you rename

    • Update references
    • Rename subpackages

enter image description here

  1. Click Ok
  2. Now click on your Manifest file
  3. Select the Manifest Tab
  4. You will notice the package option
  5. Rename it to the name you want.

enter image description here

  1. Now clean and build the project

Upvotes: 0

hakki
hakki

Reputation: 6517

Problem has solved. This is stupid Eclipse issue. Sometimes it could not understand changes. I restarted Eclipse, clenead project then everything is ok.

Upvotes: 1

fcm
fcm

Reputation: 6463

Right click on the project -> Android Tools -> Rename Application Package.
You can also change the package name on the manifest and rebuild the project.

Upvotes: 4

user626607
user626607

Reputation:

Depends really on how you set up things.

The correct way to rename would be to allow eclipse do manually update all the package references:

Try:

Right-hand click on resource > Refactor > Rename

Upvotes: 2

Related Questions