我想更改我的项目和模块的名称。但如果我试图重命名他们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更改项目名称,进入项目文件夹,重命名它…



删除。idea文件夹和。iml文件。(要显示隐藏的文件夹,按Cmd + Shift +。(点))。



打开设置。使用文本编辑器(如VSCode)编辑gradle文件,并将rootProject.name更改为您的新项目名称。



完成了!项目名称已更改!只要用Android Studio打开你的项目,Gradle就会再次同步。

其他回答

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

它完成了!不客气!)

这对我来说没问题

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 

尝试一下就会成功

以下是我在Android Studio Beta(0.8.14)中所做的事情

Changed the package name manually in the manifest file Navigated to build -> source -> r -> release and drilled down until I found R.java Selected the file and pressed F6 to rename Then from the Build menu selected Make Project Clicked the first error and pressed Shift+F6 on the package name and renamed which updated all my source files Selected my project name in Android Studio, right clicked -> Refactor -> Rename and changed the name there too. Next went to app -> build.gradle and updated my applicationId Navigate to .idea -> .name file and rename your Android Studio project in there too Just to clean up I deleted the old package folder inside build -> source -> r -> release

和vola,我的包名称现在已经更改并成功构建。

只需在build.gradle中更改应用程序id

applicationId "yourpackageName"

更改应用程序标签,在manifest中

<application 
android:label="@string/app_name" 
... />

对我有用的是:

转到

setting.gradle

更改其中的名称。 转到你想要更改并重构的应用根文件夹——>重命名它。 关闭android studio。 浏览到文件夹并更改名称 重新启动android studio。 做gradle同步。

这样就完成了!