如何在基于IntelliJ IDEA的新IDE Android Studio中重命名软件包?
是否包含自动重构?
我想进行大规模重构,但我不知道怎么做。我在Eclipse工作了两年,在Eclipse中它是一个一键操作。
如何在基于IntelliJ IDEA的新IDE Android Studio中重命名软件包?
是否包含自动重构?
我想进行大规模重构,但我不知道怎么做。我在Eclipse工作了两年,在Eclipse中它是一个一键操作。
当前回答
我需要运行文件->使缓存无效/重新启动。。。清除原始包装的残留物
其他回答
对我来说会很好的
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
试试看会奏效的
转到AndroidManifest.xml在那里,您将找到作为manifest标记属性的包。只需选择要更改的部件,右键单击->重构->重命名
也许早些时候,这很难,但到今天为止,这已经不难了。
您可能还想在中更改应用程序id
defaultConfig {
applicationId
}
短而甜
最好的方法是编写新的包名,然后从旧的包名中拖动。
第二种方法是,如果单击Refactor then move选项,然后重命名包名,它将重命名包名并重新生成。
在Build.gradle中,您必须手动执行,如果重构,则不会在Build.ggradle中重命名。
右键单击包名称->Refactor->重命名->输入包名称->单击“Refactor”。不要编辑“app”文件夹下除“build.gradle”以外的任何构建文件。
从重命名android工作室项目-Vishnu Sivan
选择要重构的包。重构(Refactor)→ 移动→ “将xxx移动到新包”。