您的位置:首页 > 移动开发 > Android开发

Android开发中遇到的exception

2015-08-11 18:05 447 查看
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lam.fundamental/com.lam.datasave.dairy.DairyActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'

环境:在启动ListActivity的时候抛出

原因:android:id="@+id/android:xxxList"

解决:把上面的改成:android:id="@+id/android:list"

android.content.ActivityNotFoundException: Unable to find explicit activity class {***************.DiaryEditActivity}; have you declared this activity in your AndroidManifest.xml?

环境:启动activity的时候抛出

原因:AndroidManifest.xml文件中未声明activity

解决:在AndroidManifest.xml中声明相应得activity.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lam.fundamental/com.lam.datasave.dairy.DairyActivity}: java.lang.IllegalArgumentException: column '_id' does not exist

环境:使用cursor的时候抛出

原因:cursor强制要求以"_id"为主键,数据库的表中没有以"_id"或者"id"命名的字段

解决:在数据库相应的表中加上该字段

The connection to adb is down, and a severe error has occured.

[2015-07-07 17:13:33 - Test] You must restart adb and Eclipse.

[2015-07-07 17:13:33 - Test] Please ensure that adb is correctly located at 'D:\DEV\tools\Android_SDK\sdk\platform-tools\adb.exe' and can be executed.

环境:运行项目的时候

原因:端口占用;

解决:关闭相应进程。很多软件带有手机助手功能,比如qq,豌豆荚,360等,在做开发的时候最好把相应功能给关闭。

FATAL EXCEPTION: main

android.view.InflateException: Binary XML file line #2: Error inflating class com.lam.myview.ToDoList

at android.view.LayoutInflater.createView(LayoutInflater.java:596)

环境:使用自定义组件的时候抛出;

原因:缺少构造器,使用资源文件构造自定义控件时,必须有包含context 和 attributeset 这两个参数的构造器

解决:在自定义的控件中添加构造器。

activity.SoftwareManagerActivity has leaked window android.widget.LinearLayout{ff5f484 V.E..... ........ 0,0-264,87} that was originally added here

at android.view.ViewRootImpl.<init>(ViewRootImpl.java:363)

at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:261)

at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)

环境:在显示popupwindow的情况下,连续点击回退键时抛出。

原因:有些控件需要依赖别的控件而存在,正如此处的popupwindow,所以,当连续点击back键时,popupwindow依赖的activity被销毁了,导致异常抛出。

解决:在activity销毁前,将popupwindow给dismiss掉。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: