Egor
Egor

Reputation: 40193

Renaming package name of a project

I've usually used Eclipse refactoring tools to rename an Android project's package name. But not long ago I've discovered this functionality in Android Tools, it's called Rename Application Package. However, using it doesn't actually rename the folders of the project, the file system naming stays the same. Now the question is: how to rename the package properly? Is it enough to use Rename Application Package tool, are should I also use refactoring to rename the actual packages? Thanks in advance.

Upvotes: 1

Views: 666

Answers (1)

user468311
user468311

Reputation:

it doesn't actually rename the folders of the project

and it shouldn't. Project folders have nothing to do with the package name. You can have different names for those two things. After you rename the package, you will have a problems with references to components in AndroidManifest.xml because most likely you have something like this:

<activity android:name=".MyAwesomeActivity"/>

Which means that your activity should be searched in the default package. But since you renamed package, you should have following:

<activity android:name="my.java.package.MyAwesomeActivity"/>

where my.java.package is actual package(project folders).

Upvotes: 1

Related Questions