3

Every time I refactor my package, random sections of my AndroidManifest file gets deleted or overwritten incorrectly.

Is there a way to prevent this from happening, or to disable the automatic editing of my AndroidManifest file when refactoring?

krikara
  • 2,395
  • 10
  • 37
  • 71
  • how do you refactor your package? I use my eclipse.look this [How to change package name of Android Project in Eclipse?][1] [1]: http://stackoverflow.com/questions/3697899/how-to-change-package-name-of-android-project-in-eclipse – eric chen May 14 '15 at 03:39
  • @ericchen Hmm, I select all my java files and select refactor. Perhaps this is a bad approach for ADT ? – krikara May 14 '15 at 03:48
  • a normal alt+shift+r when the package is highlighted didnt do it? – Droidekas May 14 '15 at 08:56

2 Answers2

1

If you want to Refactor your application package name then try -

Right Click on your project -->Android Tools -->Rename Application Package is the best way for refactor your application package name.

Hope this is help full.

Update-

IF you want to update package name then -

Right Click on Package -->Refactor --> Rename -->Enter updated Name for your package.

By above steps you can rename your package without affecting your source code and classes.

Ravi Bhandari
  • 4,682
  • 8
  • 40
  • 68
  • This changes the package name in the AndroidManifest file, however, it doesnt actually refactor the package. It also doesn't correct all the package names for each activity in the AndroidManifest file. – krikara May 14 '15 at 05:43
  • Yes it was allready mention in my answer.If you want to change each package name then right click on each package and click refator and rename it.It don not affect your code. – Ravi Bhandari May 14 '15 at 08:35
  • You should update your answer with the full details. – krikara May 14 '15 at 08:40
1

@krikara,I think so. I met the problem before and find that url on stackoverflow. Android project is no as same as the common Java project. After using the Android Tools -> Rename Application Package menu, I refactor the java package. It may need some clean on project or src(right click on src dir->soruces->clean up...).

eric chen
  • 11
  • 1