转载请注明出处:http://blog.****.net/l1028386804/article/details/46942139
1.android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
解决方式:将getApplication改成xxxx.this
2.call you are unregister onbrocastRevicer?
解决方式:忘记注销广播
3.Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE表示某个应用没有卸载完毕
4.出现launch Activtiy not found ?
由于这个Activity没有写main 和luncher參数
5.R.java was removed! Recreating R.java!
6.com.process.acore 表示的是这个应用程序有电话拨号进程
7.android.database.CursorIndexOutOfBoundsException解决方式:原因是应该先调用cursor.moveToFirst();。
数据库查询得到的cursor里面仅仅有1个结果,你却查找第-1个,肯定不正确
8.launcher.apk启动程序在启动动画页面卡住,原因是开机动画非常暂用cpu,假设luancher里面的某部分代码堵塞了。或者某个自己定义view中部分代码太占用CPU导致的。
9.java.lang.IllegalStateException: The specified child al
ready has a parent. You must call removeView() on the child's parent first,表示是缺少对象,
解决方法:查找对象是否还在,要么就是多次事例化了
10.java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ListView(2131230732, class
android.widget.ListView) with Adapter(class com.cardroid.sdhc.medialist.SDMediaListAdapter)]
01-01 00:51:06.320: ERROR/AndroidRuntime(4035): at android.widget.ListView.layoutChildren(ListView.java:1492)
01-01 00:51:06.320: ERROR/AndroidRuntime(4035): at android.widget.AbsListView.onTouchEvent(AbsListView.java:2124)
01-01 00:51:06.320: ERROR/AndroidRuntime(4035): at android.widget.ListView.onTouchEvent(ListView.java:3315)
01-01 00:51:06.320: ERROR/AndroidRuntime(4035): at android.view.View.dispatchTouchEvent(View.java:3918)
01-01 00:51:06.320: ERROR/AndroidRuntime(4035): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:898)
01-01 00:51:06.320: ERROR/AndroidRuntime(4035): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:937)
01-01 00:51:06.320: ERROR/AndroidRuntime(4035): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:937)
解决方式:放入主线程中执行,由于此时这个LISTVIEW 载入ADAPTER是放入AsyTask里面执行的
11.Database( 2284): sqlite returned: error code = 14, msg = prepared
> statement aborts at 4: [DELETE FROM android_metadata]
> Database( 2284): DELETE failed setting locale
> Database( 2284): Failed to setLocale() when constructing, closing the
> database
> Database( 2284): android.database.sqlite.SQLiteException: unable to open
> database file
> Database( 2284): at
> android.database.sqlite.SQLiteDatabase.native_setLocale(Native Method)
> Database( 2284): at
> android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java:1950)
> Database( 2284): at
> android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1818)
> Database( 2284): at
> android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:817)
> Database( 2284): at
> android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:851)
> Database( 2284): at
> android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:844)
> Database( 2284): at
> android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:542)
> Database( 2284): at
> android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:203)
> Database( 2284): at
> android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
> Database( 2284): at
> android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:158)
> Database( 2284): at
> com.android.providers.media.MediaProvider.query(MediaProvider.java:1287)
> Database( 2284): at
> com.android.providers.media.MediaProvider.attachVolume(MediaProvider.java:3045)
> Database( 2284): at
> com.android.providers.media.MediaProvider.insertInternal(MediaProvider.java:1945)
> Database( 2284): at
> com.android.providers.media.MediaProvider.insert(MediaProvider.java:1665)
> Database( 2284): at android.content.ContentProvider
> $Transport.insert(ContentProvider.java:174)
> Database( 2284): at
> android.content.ContentResolver.insert(ContentResolver.java:587)
> Database( 2284): at
> com.android.providers.media.MediaScannerService.openDatabase(MediaScannerService.java:65)
> Database( 2284): at
> com.android.providers.media.MediaScannerService.scan(MediaScannerService.java:113)
> Database( 2284): at
> com.android.providers.media.MediaScannerService.access
> $400(MediaScannerService.java:53)
> Database( 2284): at com.android.providers.media.MediaScannerService
> $ServiceHandler.handleMessage(MediaScannerService.java:283)
> Database( 2284): at
> android.os.Handler.dispatchMessage(Handler.java:99)
> Database( 2284): at android.os.Looper.loop(Looper.java:123)
> Database( 2284): at
> com.android.providers.media.MediaScannerService.run(MediaScannerService.java:197)
> Database( 2284): at java.lang.Thread.run(Thread.java:1096)
> SQLiteOpenHelper( 2284): Couldn't open external.db for writing (will try
> read-only):
> SQLiteOpenHelper( 2284): android.database.sqlite.SQLiteException: unable
> to open database file
> SQLiteOpenHelper( 2284): at
> android.database.sqlite.SQLiteDatabase.native_setLocale(Native Method)
> SQLiteOpenHelper( 2284): at
> android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java:1950)
> SQLiteOpenHelper( 2284): at
> android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1818)
> SQLiteOpenHelper( 2284): at
> android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:817)
> SQLiteOpenHelper( 2284): at
> android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:851)
> SQLiteOpenHelper( 2284): at
> android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:844)
> SQLiteOpenHelper( 2284): at
> android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:542)
> SQLiteOpenHelper( 2284): at
> android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:203)
> SQLiteOpenHelper( 2284): at
> android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
> SQLiteOpenHelper( 2284): at
> android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:158)
> SQLiteOpenHelper( 2284): at
> com.android.providers.media.MediaProvider.query(MediaProvider.java:1287)
> SQLiteOpenHelper( 2284): at
> com.android.providers.media.MediaProvider.attachVolume(MediaProvider.java:3045)
> SQLiteOpenHelper( 2284): at
> com.android.providers.media.MediaProvider.insertInternal(MediaProvider.java:1945)
> SQLiteOpenHelper( 2284): at
> com.android.providers.media.MediaProvider.insert(MediaProvider.java:1665)
> SQLiteOpenHelper( 2284): at android.content.ContentProvider
> $Transport.insert(ContentProvider.java:174)
> SQLiteOpenHelper( 2284): at
> android.content.ContentResolver.insert(ContentResolver.java:587)
> SQLiteOpenHelper( 2284): at
> com.android.providers.media.MediaScannerService.openDatabase(MediaScannerService.java:65)
> SQLiteOpenHelper( 2284): at
> com.android.providers.media.MediaScannerService.scan(MediaScannerService.java:113)
> SQLiteOpenHelper( 2284): at
> com.android.providers.media.MediaScannerService.access
> $400(MediaScannerService.java:53)
> SQLiteOpenHelper( 2284): at
> com.android.providers.media.MediaScannerService
> $ServiceHandler.handleMessage(MediaScannerService.java:283)
> SQLiteOpenHelper( 2284): at
> android.os.Handler.dispatchMessage(Handler.java:99)
> SQLiteOpenHelper( 2284): at android.os.Looper.loop(Looper.java:123)
> SQLiteOpenHelper( 2284): at
> com.android.providers.media.MediaScannerService.run(MediaScannerService.java:197)
> SQLiteOpenHelper( 2284): at java.lang.Thread.run(Thread.java:1096)
解决方式:DBHELPER打开数据库的链接后,没有关闭,导致下次进入有问题,同一时候有的把数据库放入SDCARD。要加SDCARD的权限。
12.在LINUX以下出现R。
JAVA文件不生成的时候,是由于SDK以下的platforms/android-8/tools要加权限,为了方便经常使用
platforms/android-8/tools$ chmod a+x *
13: 问题描写叙述:E/WindowManager( 5523): android.view.WindowLeaked: Activity com.cardroid.sdhc.medialist.SDMediaListActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@30c45e38
that was originally added here
解决方式:即未能及时销毁某个PhoneWindow。
当前Activity被关闭。而在关闭的同一时候,却没能及时的调用dismiss来解除对ProgressDialog等的引用。从而系统抛出了标题中的错误,而掩盖了真正导致这个错误的异常信息。须要在ONDESTORY方法时候关闭一些DIALOG。
14:问题描写叙述,在拨打电话的时候配置文件里已经加入了权限,可是提示还须要加入权限requires android.permission.CALL_PHONE
W/dalvikvm( 5709): threadid=1: thread exiting with uncaught exception (group=0x40015568)
W/ActivityManager( 201): Permission Denial: starting Intent {
act=android.intent.action.CALL dat=tel:xxx-xxx-xxxx cmp=com.android.phone/.OutgoingCall
Broadcaster } from ProcessRecord{408c2550 5709:com.um.mplus/10072} (pid=5709, uid=10072)
requires android.permission.CALL_PHONE
E/AndroidRuntime( 5709): FATAL EXCEPTION: main
E/AndroidRuntime( 5709): java.lang.SecurityException: Permission Denial: starting Intent {
act=android.intent.action.CALL dat=tel:xxx-xxx-xxxx cmp=com
.android.phone/.OutgoingCallBroadcaster } from ProcessRecord{408c2550
5709:com.um.mplus/10072} (pid=5709, uid=10072) requires android.permission.CALL_PHONE
解决这个问题:由于这个权限,有的系统级别作了限制,所以。加入抓取异常就能够了。
1. 假设你的项目的R文件不见的话。能够试下改版本在保存,R文件不见一般都是布局文本出错导致.
2. 布局文件不能够有大写字母
3. 抛出例如以下错误WARNING: Application does not specify an API level requirement!,
是因为没有指定users sdk的缘故,改动AndroidManifest.xml文件.
增加:<uses-sdkandroid:minSdkVersion="8"></uses-sdk>
4. 机器内存的瓶颈,当apk大于我们的机器内存时,模拟器无情的抛出
Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE Please check logcat output for more details. Launch canceled!
让我们无法调试,如今我们来根治这个问题,解决方法有两种
第一种(仅限apk小于机器内存,而且已安装上当前apk,仅仅是无法再次debug)
启动模拟器。然后进入菜单
settings->applications->mange
applications-> select the application->select "unistall".
这样就能彻底删除了。然后再又一次安装这个apk就没问题了
另外一种(通用)
-partition-size 128
Eclipse中在项目Target的Options中加入。
5. 启动android模拟器时候假设提示:Failed to install on device ‘emulator-5554′: timeout
这是可能由于卡的原因导致启动超时,解决的方法:eclipse -> window -> Preferences -> Android -> DDMS -> ADB connection time out(ms).把这个时间设置的长一些,默认是5秒即5000ms, 我改成10秒就ok了。
这样就不用每次重新启动模拟器了。详细时间设置依据实际环境须要
6. 在开发的过程中常常在安装apk到模拟器上时会报出
ActivityManager: Error: Activity class {..} does not exist.
这种错误,这里总结两种解决方案:
在AndroidManifest.xml文件里查看主Activity的名字前是否有'.'符
7 执行Eclipse时出现了这个错误
No Launcher activity found!
The launch will only sync the application package on the device!
解决的方法
在AndroidManifest.xml 中加入
<category android:name="android.intent.category.LAUNCHER" />
8 出现例如以下错误,没有写入sd卡权限 java.io.FileNotFoundException: /mnt/sdcard/update.zip (Permission denied)
解决的方法,资源文件写入例如以下权限
<uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
温馨提示:本文中涉及到的典型Bug及其解决方式都是本人截止到眼下在实际项目中总结的。因为本人工作年限有限,以后在实际工作中可能会遇到其它一些Bug,本人会一如既往的总结工作中出现的问题和解决方式,所以。本文以后会持续更新。。。