Bugs and workarounds for Android development
1. Unable to resolve target ' android-7 '
Solution:
Modify the contents of the project directory in the Default.properties file target=android-7 changed to TARGET=ANDROID-12 (or other version) on it, it is best to open with TXT, and then modify the save, run on it.
The original code is as follows:
# This file was automatically generated by Android Tools.
# Do not modify the This file--YOUR changes'll be erased!
#
# This file must is 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 a error similar to this: ' Error:unable to open class file R.java '
If the "error:unable to open class file R.java No such file or directory" appears.
Solution: Workaround:
The "Build Path" for your Java environment are 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 the Source and output folder from Folders to "Project"
5) Click Apply and then "OK"
Your problem should be resolved!
-------------------------------------
3. Learn the development of Android, just start, do not know what the reason, build a helloworld,eclipse on a mistake, clear master pointing a
Error:unable to open class file E:\users\administrator\workspace\helloworld1\gen\fanghui\helloworld\r.java:no such File or directory
Depends on which SDK version you use developed, different versions of the project file structure slightly different, the latest 2.2 of the solution is that you delete the Gen folder and then click on the menu bar project-"clean, pop-up window select your project OK should be no problem
---------------------------------------
4. Help: I am a novice, recently in the book study, the Import program is in the project icon has a red fork,
Hint: error:unable to open class file. \.. \r.java Permission denied
Excuse me, what is the cause of this situation?
Help with ' error:unable to open class file R.java ' when building a Android App for the first time in Eclipse
This was 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 the error similar to this:
Error:unable to open class file R.java
Solution:
The "Build Path" for your Java environment are 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 should be resolved!
----------------------------------
5. Help: I am a novice, recently in the book study, the Import program is in the project icon has a red fork,
Hint: error:unable to open class file. \.. \r.java Permission denied
Excuse me, what is the cause of this situation?
The second solution: 1. First check your code, the code is wrong, the R.java file is not generated (generally imported programs will not have this problem) 2. Open Project----> build automatically that option tick, so that the project will be automatically compiled after each modification, so that the R.java will be up to date (this time the program is wrong, not generated) 3. Project---> Clean, click to select your project, then OK, (clean itself will reset your project settings, and after that can be automatically re-build, if a clean or a problem, then clean. Generally two times is possible). So three steps down, you'll be able to solve your problem.
Am I clean or not?
-------------------------------------
6. Today I import a game demo project, found that the project name has a red fork, the console throws error report
[2011-01-13 13:47:42-drifball] Error:unable to open class file G:\Android2.0 game development Practice Baodien code \ Source code \ 14th Chapter \drifball\gen\wyf\wpf\r.java:permission denied
Internet search "Permission denied", said to change the project's read-only properties, the results I did not find, the question is what is going on?
You can right-click the read-only file, properties, and remove the read-only option, no more prompts.
Right click on the item format, and then there will be a hint that your file is read-only, and whether it can be modified, choose OK so the building
The success of the 10 floor solved the problem.
-------------------------------------
7. Android program Debug generated main.out.xml file, error: Resource entry main is already defined
Learn Android, debug error,
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 fine.
It turned out to be an eclipse issue, run the current page under the Main.xml file, and switch to the. java file. Delete Main.out.xml, run OK
So next time is still more trouble, each need to switch.
Can be configured in Eclipse, menu windows->preference, select node Run/debug->lauching,lauch operation select the first item.
-----------------------------------
8. *.out.xml problems are always generated in Android development
After I rewrite the layout of my own Main.xml, the compilation always generates a main.out.xml and prompts the following error
Error in an XML file:aborting build.
[2010-04-01 00:38:45-androidphonedialer] res\layout\main.xml:0: Error:resource entry main is already defined.
[2010-04-01 00:38:45-androidphonedialer] res\layout\main.out.xml:0: originally defined here.
[2010-04-01 00:38:45-androidphonedialer] F:\workspace\androidphonedialer\res\layout\main.out.xml:1: Error:error parsing xml:no element found
[2010-04-01 00:55:29-androidphonedialer] Error in an XML file:aborting build.
[2010-04-01 01:07:46-androidphonedialer] Error in an XML file:aborting build.
[2010-04-01 10:52:35-androidphonedialer] Error in an XML file:aborting build.
Online someone said to set the focus of SCR, do not know how to do, ask ~
I use the eclipse IDE, Baidu Hi online can directly exchange ~ ~ Thank you
I met this one, too. It's really simple, you just click the "Run" button when you open an XML file.
WORKAROUND: After you delete the generated *.out.xml file, click the down arrow of the "Run" button and select the program you want to run. (You can also open your *.java source program and click the "Run" button)