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?
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.
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.
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),
Right click the module name: app
, Refactor -> Rename (to myApp
, click ok)
Open settings.gradle
Change ':app'
to ':myApp'
, and save
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)
From a file manager (outside of Android Studio), open your project root directory, and rename the folder app
to myApp
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With