Android SMS SQLite Crash"引起:android.database.sqlite.SQLiteException:无法将数据库从版本58降级到55"

时间:2013-11-11 10:29:09

标签: android android-sqlite

stackoverflow我正在尝试获取邮件总数,但我只是从少数用户那里得到以下例外。

此问题也在stackoverflow中的以下链接android.database.sqlite.SQLiteException: Can't downgrade database from version 58 to 55 for android sms database

中提出

我正在使用以下代码

private void totalSMS()
{
    try{
        Uri allMessages = Uri.parse("content://sms/");
        Cursor c = getContentResolver().query(allMessages, null, null, null, null);
        totalMessages = 0;

        while (c.moveToNext()) 
        {
            String messageBody = c.getString(c.getColumnIndex("body"));
            long messageLength = messageBody.length();
            double numberOfMessages = messageLength / 160.0;
            double numberOfMessagesRoundedUp = Math.ceil(numberOfMessages);

            totalMessages = (int) (totalMessages + numberOfMessagesRoundedUp);
        }
    }catch(Exception e){
        totalMessages = 0;
    }
}

我正在关注crash信息

java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:299)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by: android.database.sqlite.SQLiteException: Can't downgrade database from     version 58 to 55
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:184)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:366)
at android.content.ContentResolver.query(ContentResolver.java:372)
at android.content.ContentResolver.query(ContentResolver.java:315)

请帮我解决这个谜题。

感谢。

0 个答案:

没有答案