Reputation: 9825
I have an Android project in Eclipse that I wish to change the package name. Currently the package name is my.company.simpleapp. Under my src folder, the files are grouped into several sub-packages, namely my.company.simpleappBackend, my.company.simpleappGUI and my.company.simpleappOthers.
I wish to change my package name to com.company.simple.app, and the sub-packages to com.company.simple.app.backend, com.company.simple.app.gui and com.company.simple.app.others.
I've tried refactoring all the sub-packages to their respective new names, and changing the main package name in AndroidManifest to com.company.simple.app. It builds correctly, however in my java files, I'm still getting "import my.company.simpleapp.R" and changing it to the new naming convention yields a "cannot be resolved" error.
Help?
Upvotes: 1
Views: 307
Reputation: 602
Refer below step as it is work for me.
Modify your manifest file with your new package name as per below.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sample.app"
"com.example.sample.app" replace with your new package. It is working for me. try it.
Upvotes: 0
Reputation: 2292
The Best and Simple way is this. Just follow
RightClick on Project > Android Tools > Rename Application Package.
Now change you package name as you want.
and then now all the references in your app are changed.
Now you need to change the refractor for each package as you want.
And finally clean and build project.
I'm using this method since ages now.
Upvotes: 1
Reputation: 1982
First you need to create package
src >right click >new >package
Follow the step to move the java files to your new package.
select the java file > right click > refactor > move > select your preferred package.
or
right click on the project package > Refactor > Rename > Enter new name on the given filed of the popup screen. check the update reference check box.. and ok and ok..
clean and build the project
Upvotes: 2