Solutions for common Android development problems with the Eclipse IDE- Tutorial
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Solutions for common Android development problems with the Eclipse IDE- Tutorial,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含5688字,纯文字阅读大概需要9分钟。
内容图文
![Solutions for common Android development problems with the Eclipse IDE- Tutorial](/upload/InfoBanner/zyjiaocheng/1323/a685db152bc942d3a98a5ba83afc2cba.jpg)
Table of Contents
- 1. Solving typical Android development problems
- 2. Solving not so typical Android development problems
- 3. About this website
- 4. Links and Literature
1. Solving typical Android development problems
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.
1.1. Clean Project
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 Project → Clean.
If you have library projects, make sure to clean them too.
1.2. android.content.ActivityNotFoundException
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.
1.3. Problems with Android Debug Bridge (adb)
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 Window → Open Perspective → Other... → DDMS
To restart the adb, select the "Reset adb" in the Device View
.
If this does not work, locate the adb
and type the commands adb kill-server
followed by an adb start-server
.
1.4. LogCat
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 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 may have 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 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.
2. Solving not so typical Android development problems
This sections lists problem which happen sometimes but are not that frequently as the problems from the previous section.
2.1. java.lang.IllegalArgumentException: Binary XML file Duplicate id
Caused by an 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 is only added once to an activity.
2.2. Android editor not opened
Android provides nice editors to edit Android resource files, unfortunately these editor are not always automatically used due to bugs in the ADT. If that happens, you can open 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 that the android-sdk version is in a path without any spaces in the path name.
2.4. Timeout during deployment
If you face 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 will refuse to install an application with the error message: INSTALL_FAILED_INSUFFICIENT_STORAGE.
An Android virtual device provides by default 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 the Ideal size of data partition
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
under Linux and delete the debug.keystore
file. This file is only valid for a year and if not present, Eclipse will regenerate the password.
2.7. Error message for @Override
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. To do this, 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 are not part of the standard Java Language are either fully qualified or declared via imports.
If you see an error message with the XX cannot be resolved to a variable text, right-click in your Editor
and select Source →Organize Imports to important required packages.
原文:http://www.cnblogs.com/cute/p/4760725.html
内容总结
以上是互联网集市为您收集整理的Solutions for common Android development problems with the Eclipse IDE- Tutorial全部内容,希望文章能够帮你解决Solutions for common Android development problems with the Eclipse IDE- Tutorial所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。