转载请注明出处:http://blog.csdn.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 [email protected]
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,本人会一如既往的总结工作中出现的问题和解决方案,所以,本文以后会持续更新。。。
版权声明:本文为博主原创文章,未经博主允许不得转载。