我在 HTC Wildfire 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 上的应用程序并没有导致任何崩溃。