我想更改我的项目和模块的名称。但如果我试图重命名他们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: label = "…" 到应用程序的名称。一旦Id改变了这个,标题和实际的应用程序名称就变成了这个:)

其他回答

在Android Studio中更改应用程序名称:

在Android studio中关闭项目,并从启动器的快速启动侧删除它(名称旁边应该是一个mini)。 关闭Android Studio。 进入你的应用程序文件所在的位置,重命名它(在我的文档通常)。 重新启动Android Studio,选择添加新项目,并导航到重命名的文件夹。

更改应用程序启动器的标签/应用程序的实际名称:

进入初始文件夹(app) 进入舱单 进入AndroidManifest.xml。 重命名android:label= _____为任何你想重命名你的应用程序

例如:android:label=“开发者门户”。

单击“保存全部”。

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

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

尝试更改AndroidManifest.xml中的android:label,然后重新安装/重新运行app:

<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">

在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上运行

这对我来说没问题

Change Following.

步骤1:确保ApplicationId和PackageName相同。 例子:

  android {
  defaultConfig {
                     applicationId "com.example.myapplication"
                 }
       }
 and package name the same. package="com.example.myapplication"

步骤2 删除iml文件在我的情况下:

  Go To Project> >C:\Users\ashif\Documents\MyApplication  .iml file // delete 
if you forget Project Path Then Go To android Studio Right Click on app and go to  Show in Explorer you get your Project and remove .iml file

步骤3 关闭项目

步骤4 现在复制您的旧项目,并粘贴任何其他根或复制项目文件夹,并粘贴任何 其他的意外死亡。

 Example C:\Users\ashif\Documents/MyApplication 

步骤5

Now open Android Studio and open Existing Project 
C:\Users\ashif\Documents/MyApplication 

尝试一下就会成功