Android Modify R Package name method

Source: Internet
Author: User

For the following conditions, we may need to modify the R package name of the Android project:
1. When the project is not under MAVEN management, but you need to package the same project into multiple apk with different names, but also need to be installed on the same phone (very strange request), Android APK installation is based on the APK in the Androidmenifest.xml File page property to get the package name, the installation of the same package name will conflict, the package name of the same will fail to install the latter!
2. We copied a project, made a wide range of changes, and then packaged it, okay, conflict, because the package name of the previous project conflicts!

The Android tool comes with the ability to modify the application package:
1 "Right-click Project, select Android Tools, select Rename Application package in the display list
2. Modify the package name, OK, complete.

Comparison of the two-force modification steps are as follows (how much will be a bit troublesome):
1 "Open Androidmenifest.xml file---> Modify <manifest page=" com. New package name "> Label---> Report, the project will report an R file error because the R file is based on <manifest Page= "com. New package name" > tag in the page to generate, because we modified the configuration, so all references to the old R file Java file will be error.
2 "Next we need to batch modify all the Java files that reference the old R file, and change the old R package path to new. First click Select in the Package Explorer panel (which is the panel that displays the list of all our items), select the Search button in the toolbar at the top of the IDE, select the Flie search option in the drop-down list of the search button, and in the panel that appears, Fill in the containing text: COM. old package name. R, in File name patterns (separated by comma:), fill in: *.java, select selected Resources in scope, Click the Replace button.
3 After the IDE finds the eligible Java files in the current project, fill in the popup panel: COM. new package name. R, click the Replace button, done

Android Modify R Package name method

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.