1

This is a follow up question to this question: Android Studio Rename Package

I got 2 app modules which uses another module as a library. One of the app modules had the same package name as the library and the other app module had another name. Now I want to change the module name which is the same one as the library to a have a different package name so I will have:

1) Package name for library - for example com.library.name

2) Package name for app1 - for example com.first.app

3) Package name for app2 - for example com.second.app

However, when I try to refactor, Android Studio wants to change the package name in the library as well, instead of changing it in the app alone.

How can I change the package name of a module without refactoring the package name of the library module as well?

CodeMonkey
  • 11,196
  • 30
  • 112
  • 203

1 Answers1

1
  1. Create new package com.first.app in app1 module
  2. Drag and drop in Project navigator view (toggled by Alt+7 or Cmd+7 hotkey) the whole lot of classes and subpackages you wish to move to the new package
  3. Repeat for rest of your modules respectively

Just to be clear. This is the Project navigator view:

enter image description here

Клаус Шварц
  • 3,158
  • 28
  • 44
  • I actually ended up just changing the name in the gradle file by refactoring which didn't cause troubles, and in the manifest I just renamed it and rebuilt everything which surprisingly worked well – CodeMonkey Aug 27 '17 at 13:10