Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change project name on Android Studio

I want to change the name of my project and module. But if I try to rename them Android Studio notify me some errors...

e.g. I want to change the name from "MyApplication" to "AndroidApp" as shown in the image below.
enter image description here
In the first rectangle I want to change it in:

AndroidApp ("G:...\Android\AndroidApp).

In the second rectangle I want to change it in:

AndroidApp [AndroidApp-AndroidApp]

edit: This is the log:

Gradle: Project 'AndroidApp' not found in root project 'MyApplicationProject'.

build.gradle:

buildscript {     repositories {         mavenCentral()     }     dependencies {         classpath 'com.android.tools.build:gradle:0.5.+'     } } apply plugin: 'android'  repositories {     mavenCentral() }  android {     compileSdkVersion 18     buildToolsVersion "18.0.1"      defaultConfig {         minSdkVersion 7         targetSdkVersion 16     } }  dependencies {     compile 'com.android.support:support-v4:18.0.0' } 

settings.gradle:

include ':MyApplication' 
like image 967
RobertoAV96 Avatar asked Aug 16 '13 15:08

RobertoAV96


People also ask

Can I change Android package name?

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.


2 Answers

This did the trick for me:

  • Close Android Studio
  • Change project root directory name
  • Open Android Studio
  • Open the project (not from local history but by browsing to it)
  • Clean project

If your settings.gradle contains the below line, either delete it or update it to the new name.

rootProject.name = 'Your project name' 

Edit:
Working in all versions! Last test: Android 4.2.1 Jun 2021.

like image 156
Ilya Gazman Avatar answered Sep 20 '22 17:09

Ilya Gazman


You can change the name that is shown in the title bar in the file ".idea/.name".

like image 26
Moritz Avatar answered Sep 20 '22 17:09

Moritz