Android development exceptions and Solutions
Android development errors and Solutions
1. Unable to resolve target 'android-7'
Solution:
Modify default under the project directory. change target = android-7 to target = android-12 (or another version) in the properties file. open the file in txt, save the modification, and run the file.
The original code is as follows:
# This file is automatically generated by Android Tools.
# Do not modify this file -- your changes will be erased!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "Build. properties", and override values to adapt the script to your
# Project structure.
# Project target.
Target = android-8
--------------------------------------------
2. Android Error: Unable to open class file R. java
You 've just installed Eclipse, and attempted to create your first Android Application. When clicking create, you see an error similar to this: "Error: Unable to open class file R. java"
If "Error: Unable to open class file R. java No such file or directory" appears ".
Solution:
The "Build Path" for your Java environment is not setup correctly in Eclipse. To fix this, follow these steps:
1) Open the Preferences Window by clicking "Window-> Preferences"
2) Find the "Java" section and expand it
3) Select "Build Path"
4) Change the value of Source and output folder from Folders to "Project"
5) Click Apply and then "OK"
Your problem shocould be resolved!
-------------------------------------
3. Learning about android development is just getting started. I don't know why. Setting up a helloworld makes an error in eclipse.
ERROR: Unable to open class file E: \ Users \ Administrator \ workspace \ helloworld1 \ gen \ fanghui \ helloworld \ R. java: No such file or directory
It depends on which sdk version you are using. The file structure of different versions of the project is slightly different. In the latest 2.2, the solution is to delete the gen folder and click "project-" clean "in the menu bar, select your project in the pop-up window. OK.
---------------------------------------
4. Help: I am a newbie. Recently, when I was studying books, all the imported programs had a red cross on the project icon,
Tip: ERROR: Unable to open class file... \ R. java Permission denied
What is the cause of this situation?
Help with "Error: Unable to open class file R. java" when building an Android App for the first time in Eclipse
This is just a really, quick and dirty post to help resolve this issue.
Problem:
You 've just installed Eclipse (5.2.x at the time of this writing), and attempted to create your first Android Application. When clicking create, you see an error similar to this:
Error: Unable to open class file R. java
Solution:
The "Build Path" for your Java environment is not setup correctly in Eclipse. To fix this, follow these steps:
1) Open the Preferences Window by clicking Window-> Preferences
2) Find the Java section and expand it
3) Select Build Path
4) Change the value of Source and output folder from Folders to Project
5) Click Apply and then OK
Your problem shocould be resolved!
----------------------------------
5. Help: I am a newbie. Recently, when I was studying books, all the imported programs had a red cross on the project icon,
Tip: ERROR: Unable to open class file... \ R. java Permission denied
What is the cause of this situation?
Solution 2: 1. check your code first. The code is incorrect. java files cannot be generated (this problem does not occur in general imported programs. open the Project ----> Build Automatically option, so that the Project will be Automatically compiled after each modification, so that R. java will be the latest (at this time, the program is incorrect and will not be generated) 3. project ---> Clean, click open, select your Project, and then OK (clean will Reset your Project settings, and then automatically Build again later, if there is still a problem with clean, clean it again. It usually takes two times ). In this way, you can solve your problem.
I am clean, but I still cannot.
-------------------------------------
6. I imported a game demo project today and found that there is a Red Cross in the project name. The console throws an error report.
[13:47:42-DrifBall] ERROR: Unable to open class file G: \ Android2.0 game development practices source code \ chapter 14th \ DrifBall \ gen \ wyf \ wpf \ R. java: Permission denied
I searched "Permission denied" online and said that I had not found the result of changing the read-only attribute of the project. What is the problem?
Right-click the read-only file and choose Properties> remove the read-only option.
Right-click the project format, and a prompt will be displayed, indicating whether your file is read-only and can be modified. Select OK. # 10th floor
Solved the problem by referring to the 10 th floor.
-------------------------------------
7. The main. out. xml file is generated during debugging of the Android program. The following error occurs: Resource entry main is already defined.
Learn about Android and report errors during debugging,
20:47:58-TextView] Error in an XML file: aborting build.
[2011-09-07 20:47:58-TextView] res \ layout \ main. xml: 0: error: Resource entry main is already defined.
[2011-09-07 20:47:58-TextView] res \ layout \ main. out. xml: 0: Originally defined here.
The code is correct.
It turned out to be an Eclipse problem. Run the current page under the main. xml file and switch to the. java file. Delete main. out. xml and run OK.
In this way, it will be troublesome next time, and you need to switch each time.
You can configure it in Eclipse, choose Windows> Preference, select node Run/Debug> Lauching, and select the first item for Lauch Operation.
-----------------------------------
8. Android development always generates *. out. xml issues
After I changed main. xml under layout, compilation always produces another main. out. xml file with the following error prompt:
Error in an XML file: aborting build.
[00:38:45-AndroidPhoneDialer] res \ layout \ main. xml: 0: error: Resource entry main is already defined.
[00:38:45-AndroidPhoneDialer] res \ layout \ main. out. xml: 0: Originally defined here.
[00:38:45-AndroidPhoneDialer] F: \ workspace \ AndroidPhoneDialer \ res \ layout \ main. out. xml: 1: error: Error parsing XML: no element found
[00:55:29-AndroidPhoneDialer] Error in an XML file: aborting build.
[01:07:46-AndroidPhoneDialer] Error in an XML file: aborting build.
[10:52:35-AndroidPhoneDialer] Error in an XML file: aborting build.
Some people on the Internet say they want to set the focus of the SCR. They don't know how to do it. Ask for advice ~
I am using eclipse IDE. Baidu Hi can communicate directly online ~~ Thanks.
I also met this. In fact, it is very simple. You just click the "run" button when opening an XML file.
Solution: After deleting the generated *. out. xml file, click the down arrow of the "run" button and select the program to run. (You can also open your *. java source program and click "run)