How to effectively solve the problem of changing the package name and ui refactoring error for Android apps

Source: Internet
Author: User

Package name is an identifier assigned to each application in the Android system. Each Application ID must be different. During application development, you may need to modify the package name. Here, we will summarize the methods for modifying the package name and common problems and effective solutions.

In AndroidManifest. the package field in xml clearly specifies the package name, but it is not enough to modify the package name of the application by modifying the package field, because the package name is directly related to the resource file R, in every acitaskfile, there is such a sentence: import (package name ). r; therefore, to modify the package name, you also need to modify the package name in all files. Android ADT provides a unified replacement tool, as shown in:

If a java class file exists in the project when using the rename application package, the unexpected exception occured error message will appear, this problem can be solved by deleting the file or canceling the corresponding comment.

But how to find this fully commented out class is not mentioned, especially when the project is relatively large, it is more helpful to effectively find the fully commented out class. At first, I tried to identify the file that caused the error by looking at the specific error log prompt. However, I found that there was no file information in the error log of eclipse. Later, we found that we can check whether the import (package name). R statement has been commented out. In this case, search-> file search finds all the files containing the package name by searching the package name, expands the query results, and checks whether the import (package name) exists ). R is commented out.

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.