Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Simple Android App (2014) Improving Our Code Simple Refactoring: Creating a Class

Boris Vukobrat
Boris Vukobrat
4,248 Points

Refactoring package name

Is there a way to refactor package name in Android Studio? I have a package name "one.two.three", and want to change it to "two.three.four"

1 Answer

Try this.

Boris Vukobrat
Boris Vukobrat
4,248 Points

Hm, yeah, I've done it by importing stuff in a new project. Your example is somewhat better but also 'painful' : ). Copying package and then manually renaming references. Refactoring upon a package works fine, but I wanted to name folders on disk differently. Instead, I think better practice is to go one level deeper and have "one.two.three.four"

Oh okay. yes it is easier to add... "four" in the end...than change the whole package name. At least now you know how to do it if you ever decide to. It is good to do what works for you :D