How Android Eclipse quickly modifies project name and package name

Source: Internet
Author: User

Http://www.bubuko.com/infodetail-845881.html

Modify the project name/package name, but also we often encountered in the development of problems, such as our development process suddenly feel that the project name is not appropriate, or the root package name is not appropriate to modify what to do?

As shown in the project, I would like to change my project name, such as changing zzz to XXX, my root package com.example.zzz name to com.byl.xxx, fast and ensure that my code will not report any errors, what should I do?

Let's talk about changing the package name first:

Modify a file name, we all know a shortcut key, mouse click on the file, press WIN+F2, some students may do so, see:

Can this be done to meet demand? The answer is no, because there are sub-packages underneath it, and we can look at the changes in this way:

What should be the right way to do it? First look at the number of sub-packages under your root package, and find the bottom-most sub-package or file (refer to the first picture):

Modify the path of the Z1, as follows:

Next the same method modifies the Z2,Z3 package name:

Finally, modify the package name of mainactivity:

OK, at this point you can see that the project has not reported any errors, but this is not finished, because the package name in our configuration list has not changed, if it does not change, we have just worked in vain:

Another classmate said, it is not very simple, I directly changed it not to have, really is this it? Let's look at the result of the direct change:

Why all the errors? Oh, the reason is very simple, because your R file path is still the original package path:

You may say this is good to do, I in the Java file one a changed not on the line, of course, you can have less files, but more, dozens of or even hundreds of times you want to change it? Is there a way to do it once and for all, of course, first open the Gen directory and modify the package name:

After confirmation (don't be afraid):

Next, modify the package name in the manifest file:

Final Result:

How, did not report any mistake!

Well, the package name has been changed, so how can the project name be modified? Direct WIN+F2? Haha, so you will find that when you copy the project to other places, the project name is still original, is not very strange?? You'll also need to open the folder where the project is located, locate the. project file, open it, modify the project name, and then right-click the Refresh project in eclipse:

All modifications Completed:

Although this does not have any technical content, but for beginners or do not know how to change the name of the project name of the classmate is very useful, issued to help everyone less detours, save development time, well, come here ^^!

How Android Eclipse quickly modifies project name and package name

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.