Android Studio >= 1.4.1
- Right click the module -> Refactor -> Rename.
- 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),
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)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…