我打了兩次上的HTC野火2,得到了這些例外:
E/AndroidRuntime(2165): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bryan.barrett.countdownforandroid/com.bryan.barrett.countdownforandroid.lettersPoints}: java.lang.IndexO
utOfBoundsException: Invalid index 0, size is 0
E/AndroidRuntime(2165): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1852)
E/AndroidRuntime(2165): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1873)
E/AndroidRuntime(2165): at android.app.ActivityThread.access$1500(ActivityThread.java:135)
E/AndroidRuntime(2165): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1054)
E/AndroidRuntime(2165): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(2165): at android.os.Looper.loop(Looper.java:150)
E/AndroidRuntime(2165): at android.app.ActivityThread.main(ActivityThread.java:4358)
E/AndroidRuntime(2165): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(2165): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(2165): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
E/AndroidRuntime(2165): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
E/AndroidRuntime(2165): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(2165): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
E/AndroidRuntime(2165): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257)
E/AndroidRuntime(2165): at java.util.ArrayList.get(ArrayList.java:311)
E/AndroidRuntime(2165): at com.bryan.barrett.countdownforandroid.lettersPoints.onCreate(Unknown Source)
和
E/Database(2165): close() was never explicitly called on database '/data/data/com.bryan.barrett.countdownforandroid/databases/progress.db'
E/Database(2165): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
E/Database(2165): at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1954)
E/Database(2165): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:902)
E/Database(2165): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:936)
E/Database(2165): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:929)
E/Database(2165): at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:612)
E/Database(2165): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:203)
E/Database(2165): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:118)
E/Database(2165): at com.bryan.barrett.countdownforandroid.a.d.<init>(Unknown Source)
E/Database(2165): at com.bryan.barrett.countdownforandroid.a.f.<init>(Unknown Source)
E/Database(2165): at com.bryan.barrett.countdownforandroid.lettersPoints.onCreate(Unknown Source)
就在你的其他問題發表例外
一起,我建議採取退一步並在引起問題的設備上對此進行更嚴格的測試。很可能它與Android版本有關。我在Nexus 7和Nexus One上快速瀏覽應用程序並沒有導致任何崩潰。
那麼,爲什麼你不把你的一些登錄代碼,並顯示它崩潰的地方?你的logcat中有什麼? – B770 2013-04-27 17:17:42
@ B770我刪除了發佈版本中的日誌代碼。我已經修復了在eclipse中使用自己的設備在logcat中獲得的所有錯誤,但對其他用戶沒有任何影響。 – Bryan 2013-04-27 17:41:41
IndexOutOfBoundsException:索引0無效,大小爲0.看起來像ArrayList有問題。也許你看代碼中的這一部分並記錄下來 – B770 2013-04-27 17:54:48