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?
|
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 Is this possible in Gradle project and how to do it? |
|||||||||
|
Android Studio >= 1.4.1
Older versions of Android StudioThe 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),
Congratulations - your module has now been renamed! (whew, time for some tea) |
|||||||||||||||||||||
|
|
In the project view on the left in Android Studio,
|
|||||||||
|
|
Android Studio 1.3.2,
|
|||||
|
|
You can do it manually, with or without changing the folder structure (consider not change it for minor impact on version controlling) Changing folder name accordingly 1- open 2- change the folder name accordingly (from 3- If other Modules have dependencies on it: open the corresponding Without changing folder name 1- open 2- add a new line on "settings.gradle":
3- If other Modules have dependencies on it: open the corresponding |
|||
|
|
|
Different people seem to have success with different methods, but when I wanted to rename my project from: com.example.myname.projectname to com.company.projectname I tried everything and the only way I got it to work in the end was: 1) Exit Android Studio 2) back everything up! (find your project folder and make a copy of it) 3) Find and replace all instances of com.example.myname.projectname with com.company.projectname Note that there are five places (actually it probably depends on your project, I had five) where you need to rename folders, as it creates subfolders called com\example\myname\projectname: project\app\src\main\java project\app\src\androidTest\java project\app\build\generated\source\buildConfig\debug\ project\app\build\generated\source\buildConfig\test\ project\app\build\generated\source\r\debug\ Also, in project.idea\ there is a file called workspace.xml - in that file you'll need to find the text com\example\myname\projectname Otherwise, do a search through the project directory to find "com.example.myname.projectname" and replace with "com.company.projectname" 4) Open Android Studio again. if the initial project directory name is the same (possibly if the project name itself is the same?) it will reopen if you had it open last time, otherwise you should be able to open as normal. 5) Go to File - Project Structure (CONTROL+ALT+SHIFT+S). 6) Under "Flavors", change the application ID to the new name. 7) Excit Android Studio and restart it. 8) Now you should be able to build your project. 9) Go have a drink, that was a lot more effort than it should have been! One really important note, you can only have ASCII letters in your package name (you may be able to have numbers, but not as the first character). Java itself allows numbers to start a package name, but Android does not: Package names in Android studio when dev name starts with a number? I was trying to rename My workaround (and from a look around the apps on my phone it seems to be what others are doing) is if you wanted a number at the start of either your company name or app name, write the word - instead of com.123company.55project perhaps use com.onetwothreecompany.fiftyfiveproject |
|||||||||
|
|
This is working for me in Android Studio 1.2.1.1 Premise: I do NOT use the refactor function of Android Studio to rename the module These are the steps I perform:
That's all. |
|||||||||
|