以下是我收到的錯誤消息:E/AndroidRuntime(416): java.lang.RuntimeException: Unable to start activity ComponentInfo java.lang.IllegalArgumentException
。我拿出應用程序文件名/軟件包名稱,但其他一切都在那裏。該應用旨在針對薑餅,但具有Froyo的最低SDK級別。當我嘗試在AVD上啓動應用程序時,我基本上會收到AVR消息。源代碼大約460行,所以我不確定錯誤的位置(沒有語法錯誤,所以我不確定我在做什麼錯誤)。以下是我所提供的源代碼的pastebin網址:http://pastebin.com/EtUP2CAB。我見過一些關於DecimalFormatSymbols和SensorSimulator等的東西,但我仍然感到困惑。因此,我很感謝在這裏找到導致此錯誤的問題的一些幫助。Java錯誤(運行時異常 - 非法參數異常) - Android
編輯:下面是錯誤日誌的最後一次運行我所做的:
02-03 20:51:21.724: D/AndroidRuntime(468): Shutting down VM
02-03 20:51:21.724: W/dalvikvm(468): threadid=1: thread exiting with uncaught exception (group=0x40015560)
02-03 20:51:21.784: E/AndroidRuntime(468): FATAL EXCEPTION: main
02-03 20:51:21.784: E/AndroidRuntime(468): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.deitel.flagquizgame/com.deitel.flagquizgame.FlagQuizGame}: java.lang.IllegalArgumentException
02-03 20:51:21.784: E/AndroidRuntime(468): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.os.Handler.dispatchMessage(Handler.java:99)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.os.Looper.loop(Looper.java:123)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.app.ActivityThread.main(ActivityThread.java:3683)
02-03 20:51:21.784: E/AndroidRuntime(468): at java.lang.reflect.Method.invokeNative(Native Method)
02-03 20:51:21.784: E/AndroidRuntime(468): at java.lang.reflect.Method.invoke(Method.java:507)
02-03 20:51:21.784: E/AndroidRuntime(468): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-03 20:51:21.784: E/AndroidRuntime(468): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-03 20:51:21.784: E/AndroidRuntime(468): at dalvik.system.NativeStart.main(Native Method)
02-03 20:51:21.784: E/AndroidRuntime(468): Caused by: java.lang.IllegalArgumentException
02-03 20:51:21.784: E/AndroidRuntime(468): at java.util.Random.nextInt(Random.java:186)
02-03 20:51:21.784: E/AndroidRuntime(468): at com.deitel.flagquizgame.FlagQuizGame.resetQuiz(FlagQuizGame.java:136)
02-03 20:51:21.784: E/AndroidRuntime(468): at com.deitel.flagquizgame.FlagQuizGame.onCreate(FlagQuizGame.java:92)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-03 20:51:21.784: E/AndroidRuntime(468): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
02-03 20:51:21.784: E/AndroidRuntime(468): ... 11 more
02-03 20:51:27.464: I/Process(468): Sending signal. PID: 468 SIG: 9
請添加錯誤日誌alos..line您收到異常的號碼 – arjoan 2012-02-04 04:09:24