我打了两次上的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