我想更改我的项目和模块的名称。但如果我试图重命名他们Android工作室通知我一些错误… 例:我想把名字从“MyApplication”改为“AndroidApp”,如下图所示。 在第一个矩形中,我想改变它:

AndroidApp (“G:...\Android\AndroidApp”).

在第二个矩形中,我想改变它:

AndroidApp [AndroidApp-AndroidApp]

编辑:这是日志:

Gradle:项目“AndroidApp”在根项目“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'

当前回答

您可以轻松地使用refactor重命名。

写,单击项目根文件夹,然后单击重构。 然后点击重命名,会弹出一个窗口,你可以在那里给出新的名字。

其他回答

1.编辑设置。gradle文件,更改rootProject.name

rootProject.name = "FirebaseDemo"
include ':app'

2.进入项目文件夹,重命名文件夹

3.删除项目中的。idea文件夹并重新构建项目

首先进入values文件夹 然后转到字符串文件夹 查找app_name 在字符串Tag中更改应用程序的名称 完成了

您可以更改文件“.idea/.name”标题栏中显示的名称。

只需从android Manifest中找到名称“android:label="AppName"”。 只需重命名标签名称(例如:“AppName”这里)所有这样的android:标签在AndroidManifest.xml。省省吧!当你运行应用程序时,你会看到新的名称

在2020年11月,解决这个问题的一个非常快速的方法是以下步骤

hit the shift key twice, a pop up will show search for a file named "settings.gradle" when it opens change the rootProject.name = "Old-name" to rootProject.name = "new name" then sync. hit the shift key twice, a pop up will show search for a file named "string.xml", when it opens change <string "app_name">old-name to <string "app_name">new-name close android studio locate androidStudioProject directory on your machine, open it and find the project by its old name, rename it to the new name. open Android Studio goto File > Open > "new name". open it from there.

目前正在Android Studio 4.1.1上运行