我想更改我的项目和模块的名称。但如果我试图重命名他们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'

当前回答

关闭Android Studio。 重命名项目根目录的文件夹。例如,将“MyApplication”更改为“Myblablabla”。 删除'。想法的文件夹。 打开Android Studio,导入更新后的项目。

其他回答

以下是它在几秒钟内的变化…… 在你的manifest。xml中 找到“android: label = " 在它前面输入你的新名字" 例如:android:label="我的新名字"

它完成了!不客气!)

关闭android studio,在文件资源管理器中重命名。iml文件 就是这样

在res>values>strings.xml中更改名称将在安装后更改应用程序菜单中显示的应用程序名称 重命名android studio项目文件夹(当android studio关闭时)可能会满足许多开发者

它为我工作的方式,以取代我的项目的旧名称为一个新名称(在我的代码库中无处不在)如下:

Close Android Studio. Rename the root folder of your project. Open Android Studio. It will not find the old project, so you must import it again. This step will generate the configuration again (no need to touch your .idea files manually), including a new .iml file with the new project name. Afterwards you can delete the old .iml file if you want. Once the renamed project is imported in Android Studio you need to rename your source packages to use the new project name in case you used the old project name as part of the package path.

注意:这适用于Android Studio 2.1.2

视频教程:https://youtu.be/7aQjiae2doU

将名称重构为com.example。[NewFileName] in path: 应用java com . example。[OldFileName] > >


进入strings.xml,在路径中修改代码为<string name="app_name " >[NewFileName]</string>: 应用程序> res >值> strings.xml


去建造。gradle (Module: app),并将代码更改为applicationId“com.example”。[NewFileName] "路径: >建立Gradle脚本。gradle(模块:app)


进入设置。gradle(项目设置)并将代码更改为rootProject.name='[NewFileName]' >建立Gradle脚本。gradle(项目设置)


现在按下同步提示


在Android Studio外将文件夹重命名为[NewFileName]


重新打开你的项目并在路径下重建项目: 构建>重建项目