The solution to writing Android programs in eclipse will not automatically generate R. java files and packages

Source: Internet
Author: User
Compile android in eclipse Program R. java file and package solution my eclipse was good and there were no problems. As a result, today I opened a new Android program and found that the project would not automatically generate R. after the Java file is imported, it cannot be imported into other projects. I installed the ndk development environment a few days ago. I don't know whether this affects the situation or the ADT upgrade is not caused by the upgrade. This problem is not caused by eclipse. It should be caused by the ADT plug-in. We recommend that you reinstall the ADT plug-in. After I reinstall it, I got it done first. Other methods won't work if I try a lot. Conclusion: Eclipse does not automatically generate the r file and needs to re-install the ADT plug-in. To reinstall ADT, go to help --> install new sofeware .. --> work with: In the input box, enter the adt url that has been installed by ADT, press enter after selection, and then proceed to the next step as prompted. URL similar: http://dl.google.com/android/ADT-15.0.0.zip

 

After updating the ADT, a new problem occurs: Unknown error: unable to build: The file dx. jar was not loaded from the SDK folder! After upgrading the ADT plug-in, eclipse suddenly encountered the above error and failed to run the android project. Platform-tools \ Lib folder was missing after upgrade (my eclipse was open ). close eclipse, using SDK manager uninstall and install "android SDK platform-Tools ". close eclipse, open the two check boxes under the top tools of SDK manager.exe under the SDK installation directory, and click the install packages button below to update. After the update is complete, start eclipse.

For details, see another blog http://www.cnblogs.com/zdz8207/archive/2012/12/03/eclipse-android-adt-build-dx-jar.html.
 

--------------------------------------------------------------

There are several major online solutions: 1. sometimes eclipse does not automatically compile, just clean the project and let R. java regenerate 2. select project> clean to check bulid automatically. After you click clean, the project is rebuilt. at this time, the Java file will be updated and generated again. If there is a wrong project, it will not be generated automatically. 3. Select a project and right-click Android tools> fix project properties. Sometimes, some errors can be corrected. 4. the match_parent attribute is not displayed in SDK layout_height of SDK 1.5/1.6/2.1 of the old version. Android: layout_height = "match_parent" causes XML compilation to fail to generate R. java: this may occur after the downgrade of the advanced version. The solution is to replace match_parent with fill_parent. When importing other source code, first, make sure that the SDK version of the source code is consistent with the default version of your eclipse. 5. Other XML and class errors in the project will not be automatically compiled, and errors in jar package references will also cause automatic compilation. Appendix: view the source code version method: Open the default. properties file and check the number after target = Android-7. Version ing: Target = Android-3 <---> Android 1.5, target = Android-4 <---> Android 1.6, target = Android-7 <---> Android 2.1, target = Android-8 <---> Android 2.2, target = Android-10 <---> Android 2.3.3, target = Android-14 <---> Android 4.0, target = Android-15 <---> Android 4.0.3, target = Android-16 <---> Android 4.1, target = Android-17 <---> Other Android 4.2 tests.
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.