Solutions for common Android development problems with the Eclipse IDE- Tutorial
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.
Solutions for common Android development problems with the Eclipse IDE- Tutorial的更多相关文章
- ADT Android Development Tools
ADT(Android Development Tools)在Eclipse编译IDE环境中,需安装ADT(Android Developer Tools)Plug-in,这是Android在Ecli ...
- Android开发 Unity3D基础 Android Development
开发环境 Window 7 Unity3D 3.3.0 MB525 defy Android 2.1-update1 本次学习: 1.认识Unity 2.Unity3D环境搭建与Android软件生成 ...
- Android development tools line_endings hacking
/******************************************************************** * Android development tools li ...
- Do's and Don'ts for Android development
Do's and Don'ts for Android development, by Futurice developers Use Gradle and its recommended proje ...
- Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment:
Administrator@DESKTOP-EHCTIOR MINGW64 /d/react-native-eyepetizer (master) $ react-native run-android ...
- [Android]Eclipse 安装 ADT[Android Development Tooling] 失败的两种解决办法
原因 最近想在新装的 Win7 里搭建一下 Android 的开发环境,虽然现在有 Android Studio 了,不过还是习惯 Eclipse 一点.众所周知的原因,Eclipse 直接安装 AD ...
- ADT-bundle(Android Development Tools)环境配置
Android开发环境有两套比较主流的:ADT-bundle和Android Studio,前者是Eclipse插件的形式进行开发,后者是Android的官方IDE. ADT环境的配置与调试:(1)安 ...
- 安装好android的adt以后重启eclipse,但是没有创建AVD的图标
安装好android的adt以后重启eclipse,但是没有创建AVD的图标: 解决方法: 1. 先检查ADT是否已经安卓成功 2. Windows--- Customize Perspective ...
- Android开发环境的安装 Eclipse
Android开发环境的安装 1 IDE Android可以使用开发的IDE有Eclipse 或者 Android Studio.Android Studio还处于v 0.1.x版本,是early a ...
随机推荐
- (转)I,P,B帧和PTS,DTS的关系
基本概念: I frame :帧内编码帧 又称intra picture,I 帧通常是每个 GOP(MPEG 所使用的一种视频压缩技术)的第一个帧,经过适度地压缩,做为随机访问的参考点,可以当成图象. ...
- linux -- chown修改文件拥有者和所在组
chown将指定文件的拥有者改为指定的用户或组,用户可以是用户名或者用户ID:组可以是组名或者组ID:文件是以空格分开的要改变权限的文件列表,支持通配符.系统管理员经常使用chown命令,在将文件拷贝 ...
- 【Java面试题】59 Math.round(11.5)等於多少? Math.round(-11.5)等於多少?
Math类中提供了三个与取整有关的方法:ceil.floor.round,这些方法的作用与它们的英文名称的含义相对应,例如,ceil的英文意义是天花板,该方法就表示向上取整,Math.ceil(11. ...
- linux常用命令中篇
1.打印当月的日期
- 而桌面app向来是web前端开发开发人员下意识的避开方
web前端语言的发展有目共睹, 从原来的pc web, 到后来的mobile SAP, 再到 nodejs,全站工程师应运而生. js快速而且稳健的发展让人不得不重视, 相应的前端开发人员的地位也越来 ...
- [转]ASP.NET MVC 5 - 给数据模型添加校验器
在本节中将会给Movie模型添加验证逻辑.并且确保这些验证规则在用户创建或编辑电影时被执行. 拒绝重复 DRY ASP.NET MVC 的核心设计信条之一是DRY: "不要重复自己(DRY ...
- c# T obj = default(T);
泛型类和泛型方法同时具备可重用性.类型安全和效率,这是非泛型类和非泛型方法无法具备的.泛型通常用在集合和在集合上运行的方法中..NET Framework 2.0 版类库提供一个新的命名空间 Syst ...
- Android移动网络如何抓取数据包
1)下载tcpdump工具 tcpdump(dump the traffic on a network)是Linux中强大的网络数据采集分析工具之一,可以将网络中传送的数据包头完全截获下来提供分析.它 ...
- GIS-013-Cesium Terrain 数据生成
一.Python 1.修改Python脚本文件 if __name__=='__main__': #sys.argv = ['F:\\000_Terrain\\T7-gdal2srtmtiles-de ...
- 【RF库Collections测试】Copy Dictionary
Name: Copy DictionarySource:Collections <test library>Arguments:[ dictionary ]Returns a copy o ...