Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Renaming modules in Android Studio?

I picked the wrong name of a specific module which I imported to the Gradle project in Android Studio.

In this face I want to rename module Facebook1 to Facebook.

Is this possible in Gradle project and how to do it?

like image 757
sandalone Avatar asked Nov 14 '14 18:11

sandalone


People also ask

Can I change package name Android?

Step 1: To rename package name in Android studio open your project in Android mode first as shown in the below image. Step 2: Now click on the setting gear icon and deselect Compact Middle Packages. Step 3: Now the packages folder is broken into parts as shown in the below image.

What is module name in Android Studio?

Module Name: This text is used as the name of the folder where your source code and resources files are visible. Package Name: This is the Java namespace for the code in your module. It is added as the package attribute in the module's Android manifest file.


1 Answers

Android Studio >= 1.4.1

  1. Right click the module -> Refactor -> Rename.
  2. Enter the new name of the module, click OK.

Older versions of Android Studio

The following worked for me, tested in Android Studio (AS) 1.1 & 1.0.2, directly after importing a project.

Under the 'Android' tree view (ATV),

  1. Right click the module name: app, Refactor -> Rename (to myApp, click ok)

  2. Open settings.gradle

  3. Change ':app' to ':myApp', and save

  4. You will be prompted to 'Sync Now', do it (the prompt is a blue link above the file)

    (Your project will disappear from ATV, but don't worry, just exit AS)

  5. From a file manager (outside of Android Studio), open your project root directory, and rename the folder app to myApp

  6. Re-open your project in AS, and you will see your module and Gradle scripts re-appear under ATV! :)

Congratulations - your module has now been renamed! (whew, time for some tea)

like image 176
T.Coutlakis Avatar answered Sep 28 '22 12:09

T.Coutlakis