android 更改项目名称,在Android Studio上更改项目名称

博客建议更新到最新版Android Studio以获取大量错误修复。遇到模块或项目重命名后构建文件未更新的问题,可以尝试直接修改文件系统的目录名和settings.gradle文件。详细步骤包括:更改模块和项目目录名称,同步更新settings.gradle文件中的模块名,然后点击工具栏的'Sync Project with Gradle Files'按钮或关闭并重新打开项目来应用更改。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

For one, I'd strongly suggest updating to the latest Android Studio (0.3.7 as of now); there are tons of bug fixes.

You're running into bug https://code.google.com/p/android/issues/detail?id=57692, which is that if you try to use the UI to rename modules or your project, it doesn't update the build files. Sorry, it's really broken right now. I'd suggest changing the directory names directly in the filesystem, and updating your settings.gradle file to reflect the changes. Your project on disk should look something like this (with many more files than what's shown here):

projectFolder

|--settings.gradle

|--applicationModuleFolder

| |--build.gradle

| |--src

it uses projectFolder's name as the project name and applicationModuleFolder as the name of the module that your Android App lives in (the upper and lower outlined boxes in your screenshot, respectively). I think the way your project is set up now, they both have the same name; you can rename both to the same new name if you like, or you can give them different names; it doesn't matter.

Once they're renamed, edit your settings.gradle file; it will look something like:

include ':applicationModuleFolder'

just change the name to your new name there as well. Once these changes are made, click the Sync Project with Gradle Files button in the toolbar (if you're running a very old version of Android Studio, it may not have that button, so you can close the project and reopen it in that case) and it should pick up the changes.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值