Rename package in Android Studio

后端 未结 30 1910
深忆病人
深忆病人 2020-11-21 05:21

How do you rename packages in the new IDE Android Studio, based on IntelliJ IDEA?

Is there an automatic refactoring included?

I want to make bulk refactorin

30条回答
  •  说谎
    说谎 (楼主)
    2020-11-21 06:07

    • The first part consists of creating a new package under java folder and selecting then dragging all your source files from the old package to this new package. After that you need to remane the package name in android manifest to the name of the new package.

    • In step 2, here is what you need to do.You need to change the old package name in applicationId under the module build.gradle in your android studio in addition to changing the package name in the manifest. So in summary, click on build.gradle which is below the "AndroidManifest.xml" and modify the value of applicationId to your new package name.

    • Then, at the very top, under build. clean your project, then rebuild. It should be fine from here.

提交回复
热议问题