Android应用程序一直崩溃..为什么?

时间:2011-11-11 09:12:21

标签: android

我已经构建了一个Android应用程序,但它似乎不稳定。它是一个具有各种异步任务的大型应用程序,可以对蓝牙打印机进行照片,加密,解密文件和打印。

然而,它有时会随机崩溃。找出问题的最佳方法是什么,我做得对不对?如果我在调试中运行它可以正常工作,它只会偶尔崩溃。

有时我会重新开启它所处的星系平板电脑,它会再次正常工作。我没有正确关闭一些东西吗?什么是测试和发现问题的最佳方法?

我应该运行这么多线程吗?

enter image description here

     11-10 16:20:30.495: ERROR/StorageNotification(2489): onStorageStateChanged :: Media { /mnt/sdcard } state changed from { unmounted } -> { checking }
11-10 16:20:30.773: ERROR/WifiHW(2489): wifi_connect_to_supplicant:IFACE_DIR(/data/misc/wifi), iface(eth0), ifname(/data/misc/wifi/eth0)
11-10 16:20:30.773: ERROR/WifiHW(2489): wifi_connect_to_supplicant: ifname(/data/misc/wifi/eth0)
11-10 16:20:31.097: ERROR/HierarchicalStateMachine(2489): TetherMaster - unhandledMessage: msg.what=3
11-10 16:20:31.694: ERROR/DftBootBroadcastReceiver(2715): SHOULD_SHUT_DOWN_F set complete
11-10 16:20:31.694: ERROR/DftBootBroadcastReceiver(2715): wrong Action : android.intent.action.BOOT_COMPLETED
11-10 16:20:31.874: ERROR/Setting(2590): Intent Action android.intent.action.BOOT_COMPLETED
11-10 16:20:31.976: ERROR/STKReceiver(2579): onReceive android.intent.action.BOOT_COMPLETED
11-10 16:20:32.593: ERROR/CscParser(2579): fileName + /system/csc/customer.xml
11-10 16:20:32.694: ERROR/CscReceiver(2579): onReceive android.intent.action.BOOT_COMPLETED
11-10 16:20:32.702: ERROR/CscParser(2579): fileName + /system/SW_Configuration.xml
11-10 16:20:32.718: ERROR/CscReceiver(2579): PATH_CSCNAME =CustomerDataSet.CSCName
11-10 16:20:32.737: ERROR/CscReceiver(2579): check_3
11-10 16:20:32.765: ERROR/CscUpdateService(2579): onStart
11-10 16:20:36.444: ERROR/NetworkStateTracker(2489): net.tcp.buffersize.hsdpa not found in system properties. Using defaults
11-10 16:20:36.530: ERROR/HierarchicalStateMachine(2489): TetherMaster - unhandledMessage: msg.what=3
11-10 16:20:36.929: ERROR/MTP-LAUNCHER(2585): Action : file:///system/media
11-10 16:20:37.761: ERROR/StorageNotification(2489): onStorageStateChanged :: Media { /mnt/sdcard } state changed from { checking } -> { mounted }
11-10 16:20:37.773: ERROR/StorageNotification(2489): onStorageStateChanged :: Media { /mnt/sdcard/external_sd } state changed from { unmounted } -> { checking }
11-10 16:20:38.530: ERROR/SMSDispatcher(2579): intent.getAction() : android.provider.Telephony.GET_SMSC
11-10 16:20:39.687: ERROR/Setting(2590): Intent Action android.intent.action.MEDIA_SCANNER_STARTED
11-10 16:20:39.687: ERROR/Setting(2590): media scanner start is first time. 
11-10 16:20:39.690: ERROR/Setting(2590): Battery charging. plugType = 0
11-10 16:20:39.690: ERROR/Setting(2590): AC charge
11-10 16:20:40.433: ERROR/FastDormancy(2579):  before ======= ENTER DORMANCY =======
11-10 16:20:40.753: ERROR/FastDormancy(2579): [FD] Before mDormFlag: false in getCapaDormancy()
11-10 16:20:40.753: ERROR/FastDormancy(2579): [FD] After mDormFlag: false in getCapaDormancy()
11-10 16:20:41.565: ERROR/MTPRx(2991): In MtpReceiverandroid.intent.action.MEDIA_SCANNER_STARTED
11-10 16:20:41.577: ERROR/(2991): In JNI_OnLoad
11-10 16:20:41.577: ERROR/(2991): initClassHelper: clearing local reference3
11-10 16:20:41.577: ERROR/(2991): initClassHelper: clearing local reference obj
11-10 16:20:41.577: ERROR/(2991): In register_android_MTP_StackInterface
11-10 16:20:41.640: ERROR/MTPRX(2991): Battery charging. plugType = 0
11-10 16:20:41.640: ERROR/MTPRx(2991): Not of USB charging. Dont lauch MTP APP
11-10 16:20:41.659: ERROR/MTPRx(2991): In MtpReceiverandroid.intent.action.MEDIA_MOUNTED
11-10 16:20:41.714: ERROR/BootReceiver(2985): registerContentObserver
11-10 16:20:41.741: ERROR/RequestQueueHelper(2964): [Thread-10/10] Next pending job not found!!
11-10 16:20:42.060: ERROR/StorageNotification(2489): onStorageStateChanged :: Media { /mnt/sdcard/external_sd } state changed from { checking } -> { mounted }
11-10 16:20:42.077: ERROR/MTPRx(2991): In MtpReceiverandroid.intent.action.MEDIA_MOUNTED
11-10 16:20:42.089: ERROR/BootReceiver(2985): registerContentObserver
11-10 16:20:42.093: ERROR/MediaScannerReceiver(2581): skip scan[/mnt/sdcard/external_sd] because InternalSD is now scanning
11-10 16:20:45.077: ERROR/libnetutils(2489): dhcp start cmd 11 : [dhcpcd:-ABK] 
11-10 16:20:45.855: ERROR/HierarchicalStateMachine(2489): TetherMaster - unhandledMessage: msg.what=3
11-10 16:20:45.898: ERROR/HierarchicalStateMachine(2489): TetherMaster - unhandledMessage: msg.what=3
11-10 16:20:45.960: ERROR/InstalledAppDetails(2590): setPackageList() configFilename:/system/etc/uninstall_lock_packages.txt
11-10 16:20:45.972: ERROR/InstalledAppDetails(2590): Application package name = com.android.qservices
11-10 16:20:45.972: ERROR/InstalledAppDetails(2590): Packages = com.gameloft.android.GAND.GloftNOHP
11-10 16:20:46.792: ERROR/CscReceiver(2579): onReceive android.intent.action.MEDIA_SCANNER_FINISHED
11-10 16:20:46.847: ERROR/MTP-LAUNCHER(2585): Action : file:///system/media
11-10 16:20:46.964: ERROR/CscReceiver(2579): check_9
11-10 16:20:47.132: ERROR/MTPRx(2991): In MtpReceiverandroid.intent.action.MEDIA_SCANNER_FINISHED
11-10 16:20:47.175: ERROR/MTP-LAUNCHER(2585): Action : file:///mnt/sdcard
11-10 16:20:47.226: ERROR/BootReceiver(2985): Ignore first ACTION_MEDIA_SCANNER_FINISHED
11-10 16:20:47.304: ERROR/Setting(2590): Intent Action android.intent.action.MEDIA_SCANNER_STARTED
11-10 16:20:47.304: ERROR/Setting(2590): media scanner start is not the first time. So return = 
11-10 16:20:47.331: ERROR/MTPRx(2991): In MtpReceiverandroid.intent.action.MEDIA_SCANNER_STARTED
11-10 16:20:47.413: ERROR/MTPRX(2991): Battery charging. plugType = 0
11-10 16:20:47.413: ERROR/MTPRx(2991): Not of USB charging. Dont lauch MTP APP
11-10 16:20:47.612: ERROR/MediaScanner(2581): Be careful if the code ends up here!!!  mDbEntryToDelete : 1
11-10 16:20:47.792: ERROR/RequestQueueHelper(2964): [OPSWorkerThread-1320942041797/14] Next pending job not found!!
11-10 16:20:48.940: ERROR/Database(2627): Error inserting package=com.android.mms class=com.android.mms.ui.ConversationList badgecount=0
11-10 16:20:48.940: ERROR/Database(2627): android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed

11-10 17:18:43.549: ERROR/WifiService(2489): =========shouldWifiStayAwake: wifiSleepPolicy 2
11-10 17:23:39.526: ERROR/WifiService(2489): =========shouldWifiStayAwake: wifiSleepPolicy 2
11-10 17:23:39.526: ERROR/WifiService(2489): =========shouldWifiStayAwake: wifiSleepPolicy 2
11-10 18:05:52.553: ERROR/WifiService(2489): =========shouldWifiStayAwake: wifiSleepPolicy 2
11-10 18:05:52.553: ERROR/WifiService(2489): =========shouldWifiStayAwake: wifiSleepPolicy 2
11-10 21:05:52.549: ERROR/WifiService(2489): =========shouldWifiStayAwake: wifiSleepPolicy 2
11-10 21:05:52.549: ERROR/WifiService(2489): =========shouldWifiStayAwake: wifiSleepPolicy 2
11-10 23:18:45.549: ERROR/WifiService(2489): =========shouldWifiStayAwake: wifiSleepPolicy 2
11-10 23:18:45.549: ERROR/WifiService(2489): =========shouldWifiStayAwake: wifiSleepPolicy 2
11-11 05:05:55.561: ERROR/WifiService(2489): =========shouldWifiStayAwake: wifiSleepPolicy 2
11-11 05:05:55.561: ERROR/WifiService(2489): =========shouldWifiStayAwake: wifiSleepPolicy 2
11-11 09:20:14.510: ERROR/ShutdownThread(2489): IsShutDownStarted()
11-11 09:20:14.510: ERROR/WindowManager(2489): isWakeKey=true isKeyDown=true isMusicActive=false
11-11 09:20:14.510: ERROR/WindowManager(2489): onWakeKeyWhenKeyguardShowingTq=true
11-11 09:20:14.510: ERROR/WindowManager(2489): if isWakeKey && isKeyDown
11-11 09:20:14.522: ERROR/SensorManager(2489): registerListener 4:P1 LightSensor delay:240
11-11 09:20:14.522: ERROR/SensorManager(2489): =======>>>Sensor Thread RUNNING <<<========
11-11 09:20:14.846: ERROR/ShutdownThread(2489): IsShutDownStarted()
11-11 09:20:14.866: ERROR/ShutdownThread(2489): IsShutDownStarted()
11-11 09:20:14.869: ERROR/SensorManager(2489): registerListener 1:BMA150 delay:60
11-11 09:20:14.916: ERROR/ShutdownThread(2489): IsShutDownStarted()
11-11 09:20:14.971: ERROR/SensorManager(2489): unregisterListener: com.android.server.PowerManagerService$12@47f4b578
11-11 09:20:14.998: ERROR/SensorManager(2489): unregisterListener: android.view.WindowOrientationListener$SensorEventListenerImpl@48197c88
11-11 09:20:15.116: ERROR/FastDormancy(2579): [SCREEN_ON] New FD Time: 5000
11-11 09:20:15.147: ERROR/WifiService(2489): =========shouldWifiStayAwake: wifiSleepPolicy 2
11-11 09:20:15.159: ERROR/FastDormancy(2579): [SCREEN_OFF] New FD Time: 5000
11-11 09:20:15.843: ERROR/ShutdownThread(2489): IsShutDownStarted()
11-11 09:20:15.846: ERROR/WindowManager(2489): isWakeKey=true isKeyDown=true isMusicActive=false
11-11 09:20:15.846: ERROR/WindowManager(2489): onWakeKeyWhenKeyguardShowingTq=true
11-11 09:20:15.846: ERROR/WindowManager(2489): if isWakeKey && isKeyDown
11-11 09:57:51.600: ERROR/MTPRx(2991): In MtpReceiverandroid.intent.action.MEDIA_UNMOUNTED
11-11 09:57:52.784: ERROR/StorageNotification(2489): onStorageStateChanged :: Media { /mnt/sdcard } state changed from { mounted } -> { unmounted }
11-11 09:57:52.815: ERROR/MediaProvider(2581): mUnmountReceiver - Intent.getAction : android.intent.action.MEDIA_UNMOUNTED, path[/mnt/sdcard]
11-11 09:57:52.842: ERROR/MTPRx(2991): In MtpReceiverandroid.intent.action.MEDIA_UNMOUNTED
11-11 09:57:52.873: ERROR/StorageNotification(2489): onStorageStateChanged :: Media { /mnt/sdcard } state changed from { unmounted } -> { shared }
11-11 09:59:03.530: ERROR/MTPRx(2991): In MtpReceiverandroid.intent.action.UMS_DISCONNECTED
11-11 09:59:03.600: ERROR/MediaProvider(2581): mUnmountReceiver - Intent.getAction : android.intent.action.MEDIA_UNMOUNTED, path[/mnt/sdcard]
11-11 09:59:03.639: ERROR/MTPRx(2991): In MtpReceiverandroid.intent.action.MEDIA_UNMOUNTED
11-11 09:59:03.651: ERROR/StorageNotification(2489): onStorageStateChanged :: Media { /mnt/sdcard } state changed from { shared } -> { unmounted }
11-11 09:59:03.995: ERROR/MTPRx(2991): In MtpReceiverandroid.intent.action.ACTION_POWER_DISCONNECTED
11-11 09:59:04.620: ERROR/MediaProvider(2581): mUnmountReceiver - Intent.getAction : android.intent.action.MEDIA_UNMOUNTED, path[/mnt/sdcard/external_sd]
11-11 09:59:04.635: ERROR/MTPRx(2991): In MtpReceiverandroid.intent.action.MEDIA_MOUNTED
11-11 09:59:04.670: ERROR/BootReceiver(3325): registerContentObserver
11-11 09:59:05.151: ERROR/HJ(2581): ACTION_MEDIA_UNMOUNTED. shutDown : false, ums : false, mSdSerial : null
11-11 09:59:05.182: ERROR/MTPRx(2991): In MtpReceiverandroid.intent.action.MEDIA_UNMOUNTED
11-11 09:59:05.205: ERROR/MTPRx(2991): In MtpReceiverandroid.intent.action.MEDIA_MOUNTED
11-11 09:59:05.213: ERROR/BootReceiver(3325): registerContentObserver
11-11 09:59:05.276: ERROR/MediaScannerReceiver(2581): skip scan[/mnt/sdcard/external_sd] because InternalSD is now scanning
11-11 09:59:05.299: ERROR/MTP-LAUNCHER(2585): Action : file:///mnt/sdcard
11-11 09:59:05.299: ERROR/Setting(2590): Intent Action android.intent.action.MEDIA_SCANNER_STARTED
11-11 09:59:05.299: ERROR/Setting(2590): media scanner start is not the first time. So return = 
11-11 09:59:05.307: ERROR/MTPRx(2991): In MtpReceiverandroid.intent.action.MEDIA_SCANNER_STARTED
11-11 09:59:05.334: ERROR/MTPRX(2991): Battery charging. plugType = 0
11-11 09:59:05.334: ERROR/MTPRx(2991): Not of USB charging. Dont lauch MTP APP
11-11 09:59:05.709: ERROR/StorageNotification(2489): onStorageStateChanged :: Media { /mnt/sdcard } state changed from { unmounted } -> { checking }
11-11 09:59:05.734: ERROR/StorageNotification(2489): onStorageStateChanged :: Media { /mnt/sdcard } state changed from { checking } -> { mounted }
11-11 09:59:05.741: ERROR/StorageNotification(2489): onStorageStateChanged :: Media { /mnt/sdcard/external_sd } state changed from { shared } -> { unmounted }android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
11-11 10:06:05.870: ERROR/Database(3497):     at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1919)
11-11 10:06:05.870: ERROR/Database(3497):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:883)
11-11 10:06:05.870: ERROR/Database(3497):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:960)
11-11 10:06:05.870: ERROR/Database(3497):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:953)
11-11 10:06:05.870: ERROR/Database(3497):     at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:600)
11-11 10:06:05.870: ERROR/Database(3497):     at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:203)
11-11 10:06:05.870: ERROR/Database(3497):     at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
11-11 10:06:05.870: ERROR/Database(3497):     at com.android.qservices.AdminActivity.inputStreamToString(AdminActivity.java:462)
11-11 10:06:05.870: ERROR/Database(3497):     at com.android.qservices.AdminActivity$CreateTablesTask.doInBackground(AdminActivity.java:268)
11-11 10:06:05.870: ERROR/Database(3497):     at com.android.qservices.AdminActivity$CreateTablesTask.doInBackground(AdminActivity.java:1)
11-11 10:06:05.870: ERROR/Database(3497):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
11-11 10:06:05.870: ERROR/Database(3497):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
11-11 10:06:05.870: ERROR/Database(3497):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
11-11 10:06:05.870: ERROR/Database(3497):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
11-11 10:06:05.870: ERROR/Database(3497):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
11-11 10:06:05.870: ERROR/Database(3497):     at java.lang.Thread.run(Thread.java:1096)
11-11 10:06:05.916: ERROR/Database(3497): close() was never explicitly called on database '/data/data/com.android.qservices/databases/q.db' 
11-11 10:06:05.916: ERROR/Database(3497): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
11-11 10:06:05.916: ERROR/Database(3497):     at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1919)
11-11 10:06:05.916: ERROR/Database(3497):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:883)
11-11 10:06:05.916: ERROR/Database(3497):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:960)
11-11 10:06:05.916: ERROR/Database(3497):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:953)
11-11 10:06:05.916: ERROR/Database(3497):     at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:600)
11-11 10:06:05.916: ERROR/Database(3497):     at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:203)
11-11 10:06:05.916: ERROR/Database(3497):     at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
11-11 10:06:05.916: ERROR/Database(3497):     at com.android.qservices.IncidentIdService$UploadFilesTask.doInBackground(IncidentIdService.java:83)
11-11 10:06:05.916: ERROR/Database(3497):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
11-11 10:06:05.916: ERROR/Database(3497):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
11-11 10:06:05.916: ERROR/Database(3497):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
11-11 10:06:05.916: ERROR/Database(3497):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
11-11 10:06:05.916: ERROR/Database(3497):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
11-11 10:06:05.916: ERROR/Database(3497):     at java.lang.Thread.run(Thread.java:1096)
11-11 10:06:06.276: ERROR/Camera(3553): onDestroy() exit
11-11 10:06:31.991: ERROR/Database(3497): close() was never explicitly called on database '/data/data/com.android.qservices/databases/q.db' 
11-11 10:06:31.991: ERROR/Database(3497): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
11-11 10:06:31.991: ERROR/Database(3497):     at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1919)
11-11 10:06:31.991: ERROR/Database(3497):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:883)
11-11 10:06:31.991: ERROR/Database(3497):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:960)
11-11 10:06:31.991: ERROR/Database(3497):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:953)
11-11 10:06:31.991: ERROR/Database(3497):     at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:600)
11-11 10:06:31.991: ERROR/Database(3497):     at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:203)
11-11 10:06:31.991: ERROR/Database(3497):     at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
11-11 10:06:31.991: ERROR/Database(3497):     at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:158)
11-11 10:06:31.991: ERROR/Database(3497):     at com.android.qservices.IncidentPhotoActivity.getIncidentPicId(IncidentPhotoActivity.java:59)
11-11 10:06:31.991: ERROR/Database(3497):     at com.android.qservices.IncidentPhotoActivity.initAvatar(IncidentPhotoActivity.java:80)
11-11 10:06:31.991: ERROR/Database(3497):     at com.android.qservices.IncidentPhotoActivity.onCreate(IncidentPhotoActivity.java:54)
11-11 10:06:31.991: ERROR/Database(3497):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-11 10:06:31.991: ERROR/Database(3497):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-11 10:06:31.991: ERROR/Database(3497):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-11 10:06:31.991: ERROR/Database(3497):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-11 10:06:31.991: ERROR/Database(3497):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-11 10:06:31.991: ERROR/Database(3497):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-11 10:06:31.991: ERROR/Database(3497):     at android.os.Looper.loop(Looper.java:123)
11-11 10:06:31.991: ERROR/Database(3497):     at android.app.ActivityThread.main(ActivityThread.java:4627)
11-11 10:06:31.991: ERROR/Database(3497):     at java.lang.reflect.Method.invokeNative(Native Method)
11-11 10:06:31.991: ERROR/Database(3497):     at java.lang.reflect.Method.invoke(Method.java:521)
11-11 10:06:31.991: ERROR/Database(3497):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
11-11 10:06:31.991: ERROR/Database(3497):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
11-11 10:06:31.991: ERROR/Database(3497):     at dalvik.system.NativeStart.main(Native Method)
11-11 10:06:36.995: ERROR/CachedBluetoothDeviceManager(2590): Got bonding state changed for 00:22:58:0B:BE:BE, but we have no record of that device.
11-11 10:06:37.233: ERROR/InputMethodService(2574): Keyboard State : 0
11-11 10:06:52.514: ERROR/DBUS-HCI(2819): ...get_auth_requirements unimplemented
11-11 10:06:52.526: ERROR/ADAPTER(2819): Unable to add connection 257
11-11 10:07:25.729: ERROR/InputMethodService(2574): Keyboard State : 0
11-11 10:07:28.463: ERROR/InputMethodService(2574): Keyboard State : 0
11-11 10:07:28.467: ERROR/InputMethodService(2574): Keyboard State : 0
11-11 10:07:30.803: ERROR/InputMethodService(2574): Keyboard State : 0
11-11 10:07:42.561: ERROR/fileupload(3497): Start
11-11 10:07:42.623: ERROR/fileupload(3497): after writeByte
11-11 10:07:42.741: ERROR/fileupload(3497): Start
11-11 10:07:42.834: ERROR/fileupload(3497): after writeByte
11-11 10:07:47.038: ERROR/fileupload(3497): Start
11-11 10:07:47.788: ERROR/fileupload(3497): after writeByte
11-11 10:07:49.565: ERROR/fileupload(3497): Start
11-11 10:07:49.584: ERROR/fileupload(3497): Start
11-11 10:07:49.616: ERROR/fileupload(3497): after writeByte
11-11 10:07:49.623: ERROR/fileupload(3497): after writeByte
11-11 10:07:50.010: ERROR/fileupload(3497): Start
11-11 10:07:50.073: ERROR/fileupload(3497): Start
11-11 10:07:50.123: ERROR/MediaPlayer(3497): error: /mnt/sdcard/external_sd/QBics/SendQ/1_855_J7_Incidents.txt (No such file or directory)
11-11 10:07:50.123: ERROR/MediaPlayer(3497): java.io.FileNotFoundException: /mnt/sdcard/external_sd/QBics/SendQ/1_855_J7_Incidents.txt (No such file or directory)
11-11 10:07:50.123: ERROR/MediaPlayer(3497):     at org.apache.harmony.luni.platform.OSFileSystem.openImpl(Native Method)
11-11 10:07:50.123: ERROR/MediaPlayer(3497):     at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:152)
11-11 10:07:50.123: ERROR/MediaPlayer(3497):     at java.io.FileInputStream.<init>(FileInputStream.java:82)
11-11 10:07:50.123: ERROR/MediaPlayer(3497):     at com.android.qservices.UploadService$UploadFilesTask.doInBackground(UploadService.java:204)
11-11 10:07:50.123: ERROR/MediaPlayer(3497):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
11-11 10:07:50.123: ERROR/MediaPlayer(3497):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
11-11 10:07:50.123: ERROR/MediaPlayer(3497):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
11-11 10:07:50.123: ERROR/MediaPlayer(3497):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
11-11 10:07:50.123: ERROR/MediaPlayer(3497):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
11-11 10:07:50.123: ERROR/MediaPlayer(3497):     at java.lang.Thread.run(Thread.java:1096)
11-11 10:07:50.123: ERROR/fileupload(3497): Start
11-11 10:07:50.147: ERROR/fileupload(3497): after writeByte
11-11 10:07:50.166: ERROR/fileupload(3497): after writeByte
11-11 10:07:50.717: ERROR/fileupload(3497): Start
11-11 10:07:50.721: ERROR/fileupload(3497): Start
11-11 10:07:50.803: ERROR/fileupload(3497): after writeByte
11-11 10:07:50.807: ERROR/fileupload(3497): after writeByte
11-11 10:09:07.788: ERROR/fileupload(3497): Start
11-11 10:09:07.811: ERROR/fileupload(3497): Start
11-11 10:09:07.851: ERROR/fileupload(3497): after writeByte
11-11 10:09:07.854: ERROR/fileupload(3497): after writeByte
11-11 10:09:11.506: ERROR/fileupload(3497): Start
11-11 10:09:11.538: ERROR/fileupload(3497): Start
11-11 10:09:11.600: ERROR/fileupload(3497): after writeByte
11-11 10:09:11.608: ERROR/fileupload(3497): after writeByte
11-11 10:09:12.123: ERROR/fileupload(3497): Start
11-11 10:09:12.143: ERROR/fileupload(3497): Start
11-11 10:09:12.213: ERROR/fileupload(3497): after writeByte
11-11 10:09:12.217: ERROR/fileupload(3497): after writeByte
11-11 10:09:12.831: ERROR/fileupload(3497): Start
11-11 10:09:12.842: ERROR/fileupload(3497): Start
11-11 10:09:12.916: ERROR/fileupload(3497): after writeByte
11-11 10:09:12.920: ERROR/fileupload(3497): after writeByte
11-11 10:09:13.549: ERROR/fileupload(3497): Start
11-11 10:09:13.553: ERROR/fileupload(3497): Start
11-11 10:09:13.635: ERROR/fileupload(3497): after writeByte
11-11 10:09:13.635: ERROR/fileupload(3497): after writeByte
11-11 10:11:16.373: ERROR/PowerManagerService(2489): CurLock p:3 mPS:1
11-11 10:11:25.385: ERROR/InputMethodService(2574): Keyboard State : 0
11-11 10:11:29.823: ERROR/InputMethodService(2574): Keyboard State : 0
11-11 10:11:29.827: ERROR/InputMethodService(2574): Keyboard State : 0
11-11 10:11:30.014: ERROR/InputMethodService(2574): Keyboard State : 0
11-11 10:11:32.104: ERROR/InputMethodService(2574): Keyboard State : 0
11-11 10:12:19.858: ERROR/fileupload(3497): Start
11-11 10:12:19.862: ERROR/fileupload(3497): Start
11-11 10:12:19.918: ERROR/fileupload(3497): after writeByte
11-11 10:12:19.944: ERROR/fileupload(3497): after writeByte
11-11 10:12:20.526: ERROR/fileupload(3497): Start
11-11 10:12:20.530: ERROR/fileupload(3497): Start
11-11 10:12:20.605: ERROR/fileupload(3497): after writeByte
11-11 10:12:20.616: ERROR/fileupload(3497): after writeByte
11-11 10:12:21.233: ERROR/fileupload(3497): Start
11-11 10:12:21.245: ERROR/fileupload(3497): Start
11-11 10:12:21.331: ERROR/fileupload(3497): after writeByte
11-11 10:12:21.331: ERROR/fileupload(3497): after writeByte
11-11 10:12:22.053: ERROR/fileupload(3497): Start
11-11 10:12:22.053: ERROR/fileupload(3497): Start
11-11 10:12:22.131: ERROR/fileupload(3497): after writeByte
11-11 10:12:22.139: ERROR/fileupload(3497): after writeByte
11-11 10:14:24.948: ERROR/PowerManagerService(2489): CurLock p:3 mPS:1

4 个答案:

答案 0 :(得分:2)

编辑3:
您似乎还在文本文件FileNotFoundException上获得/mnt/sdcard/external_sd/QBics/SendQ/1_855_J7_Incidents.txt,我认为这是您在下面的评论中提到的CSV文件。是否保证始终存在要解析的文件?

编辑2:
我可能在我之前的编辑中提出了一个误导性的观点:根据下面的一些评论,Android设备的内部存储器(一般情况下?)就写入限制而言,受到与SD卡大致相同的限制,因此,在选择放置数据库的位置时,频繁写入引起的“磨损”不应成为限制因素(内部存储器将与SD卡一样耗尽)。

编辑1:
感谢日志输出。

我在日志中看到很多例外,这些例外抱怨数据库未正确关闭且SD卡已卸载或无法使用。

您的应用程序是否写入数据库?该数据库是否存储在SD卡上?如果是,请尝试将数据库移动到内部存储器。

通常不建议将数据库放在SD卡上,而SD卡并不总是可以访问。所有已安装的应用程序也可以看到SD卡,这会引发有关安全性的问题。从更广泛的角度来看; SD卡的使用寿命有限,可以对卡进行写入。这个数字确实很大,但不过它就在那里......

<强> ORIGIN:
我会将设备连接到开发机器(通过USB线),并在应用程序崩溃后直接在终端中发出adb logcat。然后,您将获得一个日志打印,可能会显示出错的信息。

答案 1 :(得分:1)

看看ACRA。这将允许您在应用程序崩溃时获取堆栈跟踪。

答案 2 :(得分:0)

我认为当您在调试模式下运行代码时,您运行的时间非常短,并且为什么它不会崩溃。我感觉经过一段时间后,由于处理内存的进程或代码不正确,应用程序内存不足。

尝试调试应用程序较长时间并密切关注您的logcat。尝试在自定义日志消息中记录异常,并在logcat选项卡中的eclipse中创建自定义日志条目。这将在单独的选项卡中提供与您的应用程序相关的日志。此外,尝试在所有级别处理异常。

在不知道异常的情况下,您将无法知道原因。

希望这对你有所帮助。

答案 3 :(得分:0)

  

[...]各种异步任务[...]   它只是偶尔崩溃

  

在调试中它工作正常

这肯定会给我敲响一声响亮的声音:你的问题可能与同时运行的活动之间的同步问题有关;关键字:race condition。这是重现或调试最困难的问题之一。

因此,请密切关注您的活动同步。

一个一般性说明:那些“强制关闭”错误通常是由应用程序中未捕获的异常引起的,这将导致a)反映在logcat中,b)可以通过适当的异常处理轻松处理。