在app中强制关闭 - java.util.Date.parse中的IllegalArgumentException

时间:2016-07-16 08:15:00

标签: android

我使用Android Studio创建了一个应用 它适用于很多手机,但只有很少的三星手机,它在打开App时显示强制关闭

下面是logcat日志:

01-13 21:20:28.170: D/Brazil(3462): Index:162,Values:[Ljava.lang.String;@4312c1c0
01-13 21:20:28.170: D/Brazil(3462): Index:163,Values:[Ljava.lang.String;@4312c668
01-13 21:20:28.220: D/AndroidRuntime(3462): Shutting down VM
01-13 21:20:28.220: W/dalvikvm(3462): threadid=1: thread exiting with uncaught exception (group=0x41f9d2e8)
01-13 21:20:28.230: E/AndroidRuntime(3462): FATAL EXCEPTION: main
01-13 21:20:28.230: E/AndroidRuntime(3462): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.iran.sunni.time/com.iran.sunni.time.PrayerTimeActivity}: java.lang.IllegalArgumentException
01-13 21:20:28.230: E/AndroidRuntime(3462):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2118)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2143)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at android.app.ActivityThread.access$700(ActivityThread.java:140)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at android.os.Looper.loop(Looper.java:174)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at android.app.ActivityThread.main(ActivityThread.java:4952)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at java.lang.reflect.Method.invokeNative(Native Method)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at java.lang.reflect.Method.invoke(Method.java:511)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at dalvik.system.NativeStart.main(Native Method)
01-13 21:20:28.230: E/AndroidRuntime(3462): Caused by: java.lang.IllegalArgumentException
01-13 21:20:28.230: E/AndroidRuntime(3462):     at java.util.Date.parse(Date.java:409)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at java.util.Date.<init>(Date.java:149)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at com.iran.sunni.time.PrayerTimeActivity.getTimeDiff(PrayerTimeActivity.java:799)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at com.iran.sunni.time.PrayerTimeActivity.calculateParyerTime(PrayerTimeActivity.java:461)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at com.iran.sunni.time.PrayerTimeActivity.onCreate(PrayerTimeActivity.java:323)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at android.app.Activity.performCreate(Activity.java:5188)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
01-13 21:20:28.230: E/AndroidRuntime(3462):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2082)
01-13 21:20:28.230: E/AndroidRuntime(3462):     ... 11 more
01-13 21:20:28.240: I/power(406): *** release_dvfs_lock : lockType : 1 
01-13 21:20:28.240: E/power(406): release_dvfs_lock : g_error_dvfs : 13 
01-13 21:20:28.240: D/PowerManagerService(406): releaseDVFSLockLocked : all DVFS_MIN_LIMIT are released 
01-13 21:20:28.240: W/ActivityManager(406): mDVFSLock.release()
01-13 21:20:28.240: D/WindowManager(406): mInputFocus is not null.
01-13 21:20:28.290: E/android.os.Debug(406): !@Dumpstate > dumpstate -k -t -z -d -o /data/log/dumpstate_app_error
01-13 21:20:28.310: I/dumpstate(3485): begin
01-13 21:20:28.390: D/MotionEngine(406): [@@@ Motion Engine @@@] GetMotionScenarioId -1.522712 4.606444 8.130709 0.000000 0.000000 0.000000 51 20
01-13 21:20:28.610: D/MotionEngine(406): [MotionEngine] -> PR_MOVE -> Move Recognition Lv(2)
01-13 21:20:28.610: D/MotionEngine(406): [@@@ Motion Engine @@@] Event num  71  Occured
01-13 21:20:28.610: I/MotionRecognitionService(406):  send 71=FLAT ~~
01-13 21:20:29.430: D/MotionEngine(406): [@@@ Motion Engine @@@] GetMotionScenarioId -1.503559 4.721366 8.111555 0.000000 0.000000 0.000000 51 20
01-13 21:20:30.040: E/SMD(108): DrReadUsbStatus File Open failed
01-13 21:20:30.470: D/MotionEngine(406): [@@@ Motion Engine @@@] GetMotionScenarioId -1.541866 5.018247 8.303091 0.000000 0.000000 0.000000 51 20
01-13 21:20:30.600: E/(99): RIL_onMultiClientUnsolicitedResponse:
01-13 21:20:30.600: E/(99): unsupported multiclient unsolicited response code 1009
01-13 21:20:30.600: D/SPRDENG(163): eng_atauto_thread: At Auto Report
01-13 21:20:30.600: D/SPRDENG(163): eng_atauto_thread: j=-1
01-13 21:20:30.600: D/SPRDENG(163): eng_atauto_thread: CONFIGURED
01-13 21:20:30.600: D/SPRDENG(163): eng_atauto_thread: usb_status=1
01-13 21:20:30.600: D/SPRDENG(163): eng_atauto_thread: write at auto report to PC
01-13 21:20:31.500: D/BatteryService(406): update start
01-13 21:20:31.500: D/BatteryService(406): level:100 scale:100 status:5 health:2 present:true voltage: 4250 temperature: 337 technology: Li-ion AC powered:false USB powered:true icon:17303345 invalid charger:0 online:1 charge type:0 current avg:0
01-13 21:20:31.520: D/MotionEngine(406): [@@@ Motion Engine @@@] GetMotionScenarioId -1.388637 4.730943 8.188169 0.000000 0.000000 0.000000 51 20
01-13 21:20:32.040: E/SMD(108): DrReadUsbStatus File Open failed
01-13 21:20:32.560: D/MotionEngine(406): [@@@ Motion Engine @@@] GetMotionScenarioId -1.465251 4.797980 8.293514 0.000000 0.000000 0.000000 51 20
01-13 21:20:33.100: E/(99): RIL_onMultiClientUnsolicitedResponse:
01-13 21:20:33.100: E/(99): unsupported multiclient unsolicited response code 1009
01-13 21:20:33.110: D/SPRDENG(163): eng_atauto_thread: At Auto Report
01-13 21:20:33.110: D/SPRDENG(163): eng_atauto_thread: j=-1
01-13 21:20:33.110: D/SPRDENG(163): eng_atauto_thread: CONFIGURED
01-13 21:20:33.110: D/SPRDENG(163): eng_atauto_thread: usb_status=1
01-13 21:20:33.110: D/SPRDENG(163): eng_atauto_thread: write at auto report to PC
01-13 21:20:33.250: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:33.250: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:33.250: D/MotionEngine(406): [MotionEngine] -> PR_MOVE -> Move Recognition Lv(1)
01-13 21:20:33.250: D/WindowManager(406): mInputFocus is not null.
01-13 21:20:33.250: D/WindowManager(406): mInputFocus is not null.
01-13 21:20:33.250: V/WindowManager(406): rotationForOrientationLw(orient=-1, last=0); user=0 USER_ROTATION_LOCKED mLidState=-1 mCoverState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false sensorRotation=-1
01-13 21:20:33.250: D/WindowManager(406): mInputFocus is not null.
01-13 21:20:33.260: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:33.260: D/WindowManager(406): mInputFocus is not null.
01-13 21:20:33.280: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:33.280: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:33.280: D/WindowManager(406): mInputFocus is not null.
01-13 21:20:33.280: D/WindowManager(406): mInputFocus is not null.
01-13 21:20:33.650: D/MotionEngine(406): [@@@ Motion Engine @@@] GetMotionScenarioId -1.369483 4.596867 8.264784 0.000000 0.000000 0.000000 51 20
01-13 21:20:34.040: E/SMD(108): DrReadUsbStatus File Open failed
01-13 21:20:34.130: D/VoldCmdListener(81): asec list
01-13 21:20:34.750: D/MotionEngine(406): [@@@ Motion Engine @@@] GetMotionScenarioId -1.331176 4.730943 8.197746 0.000000 0.000000 0.000000 51 20
01-13 21:20:34.850: I/dumpstate(3485): done
01-13 21:20:34.880: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:34.880: V/WindowManager(406): rotationForOrientationLw(orient=5, last=0); user=0 USER_ROTATION_LOCKED mLidState=-1 mCoverState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false sensorRotation=-1
01-13 21:20:34.890: D/WindowManager(406): mInputFocus is not null.
01-13 21:20:34.890: D/WindowManager(406): mInputFocus is not null.
01-13 21:20:34.910: D/WindowManager(406): PhoneWindowManager: focusChangedLw
01-13 21:20:34.910: D/WindowManager(406): updateReadingMode
01-13 21:20:34.910: D/STATUSBAR-StatusBarManagerService(406): setSystemUiVisibility(0x0)
01-13 21:20:34.910: D/STATUSBAR-StatusBarManagerService(406): manageDisableList what=0x0 pkg=WindowManager.LayoutParams
01-13 21:20:34.920: D/Launcher(616): onRestart, Launcher: 1117400296
01-13 21:20:34.920: D/Launcher(616): onStart, Launcher: 1117400296
01-13 21:20:34.920: D/Launcher.HomeFragment(616): onStart
01-13 21:20:34.920: D/Launcher(616): onResume, Launcher: 1117400296
01-13 21:20:34.920: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:34.940: E/Launcher(616): Error finding setting, default accessibility to not found: accessibility_enabled
01-13 21:20:34.940: D/Launcher.HomeFragment(616): onResume
01-13 21:20:34.940: D/MenuAppsGridFragment(616): onResume
01-13 21:20:34.950: D/PhoneStatusBar(495): hiding the MENU button
01-13 21:20:34.960: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:34.970: I/[Gralloc](88): PERFORM_CREATE hnd=0x4194b1b0,fd=38,offset=0x0,size=1536000,base=0x43e4f000,phys_addr=0x8f2ce000
01-13 21:20:34.970: I/(88): ================allocat  ion memory for rgba xres*yres = 480*800 fd = 38:4
01-13 21:20:34.980: I/(616): ION_IOC_IMPORT success dd3b1680,phy addr = 8f2ce000
01-13 21:20:35.000: E/Watchdog(406): !@Sync 310
01-13 21:20:35.060: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:35.060: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:35.070: I/[Gralloc](88): PERFORM_CREATE hnd=0x416a9c00,fd=42,offset=0x0,size=1536000,base=0x441c2000,phys_addr=0x8f445000
01-13 21:20:35.080: I/(88): ================allocat  ion memory for rgba xres*yres = 480*800 fd = 42:5
01-13 21:20:35.080: I/(616): ION_IOC_IMPORT success d56a6b80,phy addr = 8f445000
01-13 21:20:35.100: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:35.100: D/BatteryStatsImpl(406): ++++++xy WakeLock stop : pid=406, name=, type=0, tid=621, pid=406, pName=null
01-13 21:20:35.120: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:35.120: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:35.140: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:35.160: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:35.170: D/KeyguardUpdateMonitor(406): received broadcast android.intent.action.BATTERY_CHANGED
01-13 21:20:35.170: D/KeyguardUpdateMonitor(406): handleBatteryUpdate
01-13 21:20:35.170: D/STATUSBAR-BatteryController(495): onReceive() - ACTION_BATTERY_CHANGED
01-13 21:20:35.170: D/STATUSBAR-BatteryController(495): onReceive() - level:100
01-13 21:20:35.170: D/STATUSBAR-BatteryController(495): onReceive() - plugged:2
01-13 21:20:35.170: D/STATUSBAR-BatteryController(495): onReceive() - BATTERY_STATUS_FULL:
01-13 21:20:35.240: D/Launcher(616): onTrimMemory. Level: 5
01-13 21:20:35.250: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:35.280: D/dalvikvm(2924): GC_CONCURRENT freed 341K, 13% free 9499K/10823K, paused 18ms+2ms, total 73ms
01-13 21:20:35.360: D/STATUSBAR-PhoneStatusBar(495): ACTION_BATTERY_CHANGED
01-13 21:20:35.360: D/STATUSBAR-PhoneStatusBar(495): NORMAL_BATTERY
01-13 21:20:35.370: I/MemoryTrimmer(2779): Trimming objects from memory, since app is in the background.
01-13 21:20:35.370: I/Finsky(2506): [1] com.google.android.finsky.utils.df.onTrimMemory(25): Memory trim requested to level 5
01-13 21:20:35.480: D/dalvikvm(2779): GC_CONCURRENT freed 389K, 12% free 10796K/12167K, paused 62ms+2ms, total 194ms
01-13 21:20:35.540: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:35.540: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:35.550: D/MotionEngine(406): [MotionEngine] -> PR_MOVE -> Move Recognition Lv(1)
01-13 21:20:35.600: E/(99): RIL_onMultiClientUnsolicitedResponse:
01-13 21:20:35.600: E/(99): unsupported multiclient unsolicited response code 1009
01-13 21:20:35.600: D/SPRDENG(163): eng_atauto_thread: At Auto Report
01-13 21:20:35.600: D/SPRDENG(163): eng_atauto_thread: j=-1
01-13 21:20:35.600: D/SPRDENG(163): eng_atauto_thread: CONFIGURED
01-13 21:20:35.600: D/SPRDENG(163): eng_atauto_thread: usb_status=1
01-13 21:20:35.600: D/SPRDENG(163): eng_atauto_thread: write at auto report to PC
01-13 21:20:35.730: D/MotionEngine(406): [@@@ Motion Engine @@@] GetMotionScenarioId -1.340753 4.673482 8.283937 0.000000 0.000000 0.000000 51 20
01-13 21:20:35.770: D/KeyguardViewMediator(406): setHidden false
01-13 21:20:36.040: E/SMD(108): DrReadUsbStatus File Open failed
: E/(): Device disconnected: 1
: E/(): Device disconnected

以下是PrayerTimeActivity.java代码

http://pastebin.com/x94eGH9b

1 个答案:

答案 0 :(得分:0)

我终于找到了解决方案 我把所有代码导致强制接近尝试捕获,现在app工作正常。

感谢。