5. Error handling and typical problems
Things are not always working as they should. This section gives an overview over typical problems and how to solve them.
Several users report that get the following errors:
Project ... is missing required source folder: 'gen'
The project could not be built until build path errors are resolved.
Unable to open class file R.java.
To solve any of these errors, go to the project menu and select Project -> Clean.
The communication with the emulator or your Android device might have problems. This communication is handle by the Android Debug Bridge (adb).
Eclipse allows to reset the adb in case this causes problems. Select therefore the DDMS perspective via
→ → → To restart the adb, select the "Reset adb" in the Device View
.
The LogCat view shows you the log message of your Android device and help you analyzing problems. For example Java exceptions in your program would be shown here. To open this view, select "Window -> Show View -> Other -> Android -> LogCat" from the menu.
If your emulator does not start, make sure that the androd-sdk version is in a path without any spaces in the path name.
The @override annotation was introduced in Java 1.6. If you receive an error message for @override change the Java compiler level to Java 1.6 via right-mouse click on the project -> Properties -> Java Compiler -> Compiler compliance level and set it to "1.6".
Java requires that the classes which are not part of the standard Java Language are either fully qualified or declared via imports. In your editor use the click mouse click, select "Source-> Organize Imports" if you see error message with "XX cannot be resolved to a variable".
No comments:
Post a Comment