Renaming packages in Android Studio

This translation from: Rename Package Penalty for Android in Studio

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

Is there an automatic refactoring included? Contains automatic reconstruction?

I want to make bulk refactoring, but I do not know how. I want to make bulk reconstruction, but I do not know how to do. I worked two years with Eclipse and in Eclipse it's a one-click operation. I worked for two years at Eclipse, the Eclipse is one-button operation.


#1st Floor

Reference: https://stackoom.com/question/18VVl/ package rename the Android-Studio


#2nd Floor

Package Penalty for the Click-ON at The Right AT at The Project Panel . In the " Project Panel" on the right-click on the package.

Choose Refactor -.> Rename from the context menu select "reconstructed" from the context menu -> "Rename."


#3rd floor

More Package Penalty for your name IS IF TWO DOT Separated Within last, say com.hello.worldand moreover, you DID PUT Anything not in com/and com/hello/. If your package names separated by more than two points, for example com.hello.world, and you do not in com/and com/hello/put any content. Of your classes are putting All INTO com/hello/world/, you Might DO at The following Steps to Package Penalty for Refactoring your name (S) in Android Studio or IntelliJ: All your classes are on com/hello/world/, you can reconstruct the packet in Android Studio or IntelliJ Follow these steps name:

  • [FIRST] the Add something an under your Directories ( com/, com/hello/). [FIRST] in the catalog ( com/, com/hello/add some content) You can achieve this by first add two files to package com.hello.world, say you can do this by first adding the two files to com.hello.world package, for example,
  com.hello.world.PackageInfo1.java com.hello.world.PackageInfo2.java 

then refactor them by moving them to com and com.hello respectively. then reconstructs them by moving them, respectively, and to com com.hello. Com and com.hello by Will See by You sitting there at The AT Project ( Alt+1or Command+1for Shortcut) and the rename Directories Refactoring AS IS Waiting there you expected. You will see com and com.hello sitting there Project ( Alt+1or Command+1represent a shortcut), and rename the directory where reconstruction is being carried out according to your expectations.

  • Refactor to rename one or more of these directories to reach your aim. Reconstruction to rename one or more of these directories in order to achieve your goals. The only thing you should notice here is you must choose the directories rather than Packages when a dialog ask you. You are here only to note that when the dialog box asks you, you must select the directory instead of Packages.

  • If you've got lots of classes in your project, it will take you a while to wait for its auto-scan-and-rename. If you have a lot of class to your project, it will take some time to wait for it to automatically scan and Rename.

  • Besides, you need to rename the package name inside the AndroidManifest.xml manually, I guess, such that other names in this file can benefit the prefix. In addition, I think you need to manually rename the package name in AndroidManifest.xml so that the other names in the file prefix can benefit.

  • [ALSO] , IT Might to the replace All you need com.hello.world.Rto at The new new XXX.XXX.XXX.R( Command+Shift+Rfor Short) [ALSO] , you will probably need all com.hello.world.Rreplaced with a new XXX.XXX.XXX.R(short Command+Shift+R)

  • Rebuild and run your project to see whether it work. Rebuild and run your project to see if it is valid. And use "Find in Path" to find other non-touch names you'd like to rename. And use the "find the path" to find other non-touch name you want to rename.

  • Enjoy it. Enjoy.

#4th floor

Good Method, IS Another: First with the Create A Package Penalty for new new name by right clicking at The Desired ON at The Java Folder → NewPackage Penalty for . Another good method is: first create a new package with the Java folder → NewPackage Right-click the name required.

Then, select and drag all your classes to the new package. Then, select all classes and drag it to a new package. By Will Refactor at The Studio Package Penalty for Android name Everywhere. Android Studio will reconstruct the package name anywhere.

Finally, delete the old package. Finally, remove the old package.

Done. Done

Very important: very important:

Have have to Manually Change by You AndroidManifest.xml and build.gradle File to new new Package Penalty for at The Method, IF you use the this. If you use this method, you must manually AndroidManifest.xml and build.gradle change file for the new package.


#5th Floor

AN IDEA has the Option Called IntelliJ "Compact Empty Middle Packages Standard Package." IntelliJ IDEA has an option called "compact room air package". At The icon of the Option at The the SELECT Project the Tab and de / of an activate the this. Select the " Project" Options icon tab, and then cancel / activate it.

See: How the I CAN Change in name Top Level Package Penalty for IntelliJ IDEA? See: How to Change in IntelliJ IDEA in the top-level package name?


#6th floor

  • Consists of Creating First Part of The A new new Package an under javaFolder and the then dragging the Selecting Source Files from The All your old packageto the this new package. The first portion comprises javacreating a new folder package, and then select all source files from old packagedrag to the new package. That you need to the After remaneat The Package Penalty for Android name in manifestto at The name of at The new new Package Penalty for. After that you need remanein the Android package name manifestto the name of the new package.

  • The STEP 2 an In, here Wallpaper IS the What you need to do.You need to Change at The Old Package Penalty for name in applicationIdan under at The Module build.gradlein your Android Studio in Addition to Changing at The Package Penalty for at The name in manifest. In step 2, where you need do.You need to change the old package name what applicationIdmodules under build.gradlethe package name of your Android studio in addition to the ever-changing manifest. In the Summary SO, the Click ON build.gradleWhich IS below at The "AndroidManifest.xml" and the Modify at The value of applicationIdto your new new Package Penalty for name. So in summary, click build.gradlewhich is below the "AndroidManifest.xml in" and modify the value applicationIdto the new package first name.

  • The Then, AT at The Very Top, an under build. Then, at the top level build. cleanProject your, the then rebuild. cleanyour project, then rebuild. It should be fine from here. From here it should be no problem.

Original articles published 0 · won praise 73 · views 550 000 +

Guess you like

Origin blog.csdn.net/w36680130/article/details/105247534