Table of Contents
-
-
1. Solving typical Android development problems
-
-
-
1.1. Clean Project
-
1.2. android.content.ActivityNotFoundException
-
1.3. Problems with Android Debug Bridge (ADB)
-
1.4. LogCat
-
1.5. Java7
-
1.6. Eclipse reports file from R.java as missing
-
-
2. Solving typical Android development problems
-
-
-
2.1. java.lang.IllegalArgumentException:Binary XML file Duplicate ID
-
2.2. Android Editor not opened
-
2.3. Emulator does not start
-
2.4. Timeout during deployment
-
2.5. Installation failed due to insufficient storage
-
2.6. Debug Certificate Expired
-
2.7. Error Message for @Override
-
2.8. Missing Imports
-
-
3. About this website
-
-
4. Links and literature
-
-
-
4.1. Android Resources
-
4.2. Vogella GmbH Training and consulting support
1. Solving typical Android development problems
Things is not always working as they should during your Android development. This section gives a overview over typical problems and how to solve them.
1.1. Clean Project
Several users report, that they get the following errors:
Project ... is missing required source folder: ' Gen '
The project could not being built until build path errors is resolved.
Unable to open class file R.java.
To solve a these errors, go to the Project menu and select Project→clean.
If you have the library projects, make sure to the clean them too.
1.2. android.content.ActivityNotFoundException
During start or During execution of your application, your application stops. In the LogCat view of the message:android.content.ActivityNotFoundException:Unable to find explicit activity CL the; Declared this activity in your androidmanifest.xml?
Check in this case if you declared your activity in the AndroidManifest.xml
file.
1.3. Problems with Android Debug Bridge (ADB)
The communication with the emulator or your Android device might has problems. This communication was 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 Window→open perspective→other ... →ddms
To restart the ADB, select the ' Reset adb ' in the Device View
.
If This does isn't work, locate the and type of the adb
commands followed by an adb kill-server
adb start-server
.
1.4. LogCat
The LogCat view shows you the log messages of your Android device and helps your to analyze problems. For example Java exceptions in your program would is shown here. To open this view, select Window→show view→other ... →android→logcat.
1.5. Java7
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 could have a to select the Enable project specific settings checkbox.
1.6. Eclipse reports file from R.java as missing
Sometimes Eclipse complains that a file, e.g. R.layout.main
cannot is found. Check in your source code android.R
. An android.R
import would prevent Eclipse from finding your R
file.
2. Solving typical Android development problems
This sections lists problem which happen sometimes but is not that frequently as the problems from the previous section.
2.1. java.lang.IllegalArgumentException:Binary XML file Duplicate ID
Caused by a attempt to load the same fragment twice. The second time it is added to the Fragmentmanager this exception is thrown.
Solution:ensure that each fragment are only added once to an activity.
2.2. Android Editor not opened
Android provides nice editors to edit Android resource files, unfortunately these editor is not always automatically used Due to bugs in the ADT. If that happens, you can open the this editor manually. Right-click on your menu file and select Open with→android menu Editor.
2.3. Emulator does not start
If your emulator does not start, make sure then the ANDROID-SDK version is in a path without any spaces in the path name.
2.4. Timeout during deployment
If you face a timeout issues during deployment you can increase the default timeout in the Eclipse preferences. Select Window→preferences→android→ddms and increase the ADB connection timeout (in ms) value.
2.5. Installation failed due to insufficient storage
Sometimes the emulator would refuse to install a application with the error message:install_failed_insufficient_storage.
An Android virtual device provides by default is only 64M for the storaging Android applications. You can clean your installed application by restarting the emulator and selecting the Wipe user Data flag.
Alternatively you can set the data partition size. If you press edit on the AVD, you can set Ideal size of data partition
the property via the New button.
2.6. Debug Certificate Expired
If you get the "error message" Debug Certificate expired switch to the folder which contains the Android AVD, e.g. .android
und Er Linux and delete the debug.keystore
file. This file was only valid for a year and if not present, Eclipse would regenerate the password.
2.7. Error Message for @Override
The @Override
annotation is introduced in Java 1.6. If you receive a error message @Override
for, change the Java compiler level to Java 1.6. Right-click on the project, select Properties→java Compiler→compiler compliance level and select1.6 in the Drop-down box.
2.8. Missing Imports
Java requires that classes which is not part of the standard Java Language is either fully qualified or declared via Imp Orts.
If A error message with the XX cannot is resolved to a variable text, right-click in your and Editor
select Source →organize Imports to important required packages.
Solutions for common Android development problems with the Eclipse ide-tutorial