Things are not always working as they should during your Android development. This section gives an overview over typical problems and how to solve them.
Several users report that they 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 → .
If you have library projects, make sure to clean them too.
During start or during execution of your application, your application stops. In the LogCat view you see the message:android.content.ActivityNotFoundException : Unable to find explicit activity class; have you declared this activity in your AndroidManifest.xml?
Check in this case if you declared your activity in the
AndroidManifest.xml file.
The communication with the emulator or your Android device might have problems. This communication is handled by the Android Debug Bridge (adb).
Eclipse allows you 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 messages of your Android device and helps you to analyze problems. For example Java exceptions in your program would be shown here. To open this view, select → → → → .
If Android complains that you cannot use Java7 select your right-click on your project and select the Java Compiler entry. Ensure that Java 1.5 or Java 1.6 is used. You may have to select the Enable project specific settings checkbox.
Sometimes Eclipse complains that a file, e.g.
R.layout.main cannot be found. Check in your source code that you did not importandroid.R. An android.R import will prevent Eclipse from finding your R file.
0 comments:
Post a Comment