6

我最近更新了我的一个应用程序,但在极少数情况下会出现上述错误。仅当用户尝试在现有应用上更新应用时,才会出现此错误。这并非每次都发生在每台设备上。我在Android SQLiteException 上发现了一个类似的问题:无法将 db 的语言环境更改为 'en_US'但是回复并没有解决我的问题。我一直试图从一个小时候开始解决这个问题,但我失败了。我使用了 SQLiteDatabase,所以我没有给出任何通往我的数据库的路径。崩溃报告如下

android.database.sqlite.SQLiteException: Failed to change locale for db '/data/data/com.scoreup/databases/scoreUp' to 'en_US'.
0
android.database.sqlite.SQLiteConnection.setLocaleFromConfiguration
SQLiteConnection.java:393
1
android.database.sqlite.SQLiteConnection.open
SQLiteConnection.java:218
2
android.database.sqlite.SQLiteConnection.open
SQLiteConnection.java:193
3
android.database.sqlite.SQLiteConnectionPool.openConnectionLocked
SQLiteConnectionPool.java:463
4
android.database.sqlite.SQLiteConnectionPool.open
SQLiteConnectionPool.java:185
5
android.database.sqlite.SQLiteConnectionPool.open
SQLiteConnectionPool.java:177
6
android.database.sqlite.SQLiteDatabase.openInner
SQLiteDatabase.java:806
7
android.database.sqlite.SQLiteDatabase.open
SQLiteDatabase.java:791
8
android.database.sqlite.SQLiteDatabase.openDatabase
SQLiteDatabase.java:694
9
android.app.ContextImpl.openOrCreateDatabase
ContextImpl.java:1148
10
android.content.ContextWrapper.openOrCreateDatabase
ContextWrapper.java:268
11
android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked
SQLiteOpenHelper.java:223
12
android.database.sqlite.SQLiteOpenHelper.getWritableDatabase
SQLiteOpenHelper.java:163
13
com.scoreup.gson.DatabaseHandler.openDatabase
DatabaseHandler.java:35
14
com.scoreup.gson.DatabaseHandler.getQuizBots
DatabaseHandler.java:379
15
com.scoreup.activity.earn.fragments.EarnScreenBottomFragmentWinners.onCreateView
EarnScreenBottomFragmentWinners.java:66
16
android.app.Fragment.performCreateView
Fragment.java:2053
17
android.app.FragmentManagerImpl.moveToState
FragmentManager.java:894
18
android.app.FragmentManagerImpl.moveToState
FragmentManager.java:1067
19
android.app.BackStackRecord.run
BackStackRecord.java:834
20
android.app.FragmentManagerImpl.execPendingActions
FragmentManager.java:1452
21
android.app.FragmentManagerImpl.executePendingTransactions
FragmentManager.java:483
22
android.support.v13.app.FragmentStatePagerAdapter.finishUpdate
FragmentStatePagerAdapter.java:167
23
android.support.v4.view.ViewPager.populate
ViewPager.java:1073
24
android.support.v4.view.ViewPager.populate
ViewPager.java:919
25
android.support.v4.view.ViewPager.onMeasure
ViewPager.java:1441
26
android.view.View.measure
View.java:17547
27
android.widget.RelativeLayout.measureChildHorizontal
RelativeLayout.java:727
28
android.widget.RelativeLayout.onMeasure
RelativeLayout.java:463
29
android.view.View.measure
View.java:17547
30
android.view.ViewGroup.measureChildWithMargins
ViewGroup.java:5535
31
android.widget.LinearLayout.measureChildBeforeLayout
LinearLayout.java:1436
32
android.widget.LinearLayout.measureVertical
LinearLayout.java:722
33
android.widget.LinearLayout.onMeasure
LinearLayout.java:613
34
android.view.View.measure
View.java:17547
35
android.view.ViewGroup.measureChildWithMargins
ViewGroup.java:5535
36
android.widget.LinearLayout.measureChildBeforeLayout
LinearLayout.java:1436
37
android.widget.LinearLayout.measureVertical
LinearLayout.java:722
38
android.widget.LinearLayout.onMeasure
LinearLayout.java:613
39
android.view.View.measure
View.java:17547
40
android.view.ViewGroup.measureChildWithMargins
ViewGroup.java:5535
41
android.widget.FrameLayout.onMeasure
FrameLayout.java:436
42
android.view.View.measure
View.java:17547
43
android.support.v4.widget.DrawerLayout.onMeasure
DrawerLayout.java:851
44
android.view.View.measure
View.java:17547
45
android.view.ViewGroup.measureChildWithMargins
ViewGroup.java:5535
46
android.widget.FrameLayout.onMeasure
FrameLayout.java:436
47
android.view.View.measure
View.java:17547
48
android.view.ViewGroup.measureChildWithMargins
ViewGroup.java:5535
49
android.widget.LinearLayout.measureChildBeforeLayout
LinearLayout.java:1436
50
android.widget.LinearLayout.measureVertical
LinearLayout.java:722
51
android.widget.LinearLayout.onMeasure
LinearLayout.java:613
52
android.view.View.measure
View.java:17547
53
android.view.ViewGroup.measureChildWithMargins
ViewGroup.java:5535
54
android.widget.FrameLayout.onMeasure
FrameLayout.java:436
55
com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure
PhoneWindow.java:2615
56
android.view.View.measure
View.java:17547
57
android.view.ViewRootImpl.performMeasure
ViewRootImpl.java:2015
58
android.view.ViewRootImpl.measureHierarchy
ViewRootImpl.java:1173
59
android.view.ViewRootImpl.performTraversals
ViewRootImpl.java:1379
60
android.view.ViewRootImpl.doTraversal
ViewRootImpl.java:1061
61
android.view.ViewRootImpl$TraversalRunnable.run
ViewRootImpl.java:5885
62
android.view.Choreographer$CallbackRecord.run
Choreographer.java:767
63
android.view.Choreographer.doCallbacks
Choreographer.java:580
64
android.view.Choreographer.doFrame
Choreographer.java:550
65
android.view.Choreographer$FrameDisplayEventReceiver.run
Choreographer.java:753
66
android.os.Handler.handleCallback
Handler.java:739
67
android.os.Handler.dispatchMessage
Handler.java:95
68
android.os.Looper.loop
Looper.java:135
69
android.app.ActivityThread.main
ActivityThread.java:5254
70
java.lang.reflect.Method.invoke
Native Method
71
java.lang.reflect.Method.invoke
Method.java:372
72
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
ZygoteInit.java:903
73
com.android.internal.os.ZygoteInit.main
ZygoteInit.java:698

我的数据库代码是

    public class DatabaseHandler extends SQLiteOpenHelper {
        private static DatabaseHandler instance;
        private SQLiteDatabase dbInstance;
        private int mOpenCounter;

        private DatabaseHandler(Context context) {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
        }

        public static synchronized DatabaseHandler getDBInstance(Context context) {
            if (instance == null) {
                return new DatabaseHandler(context);
            }
            return instance;
        }

        public synchronized SQLiteDatabase openDatabase() {
            mOpenCounter++;
            if (mOpenCounter == 1) {
                // Opening new database
                dbInstance = this.getWritableDatabase();
            }
            return dbInstance;
        }

        public synchronized void closeDatabase() {
            mOpenCounter--;
            if (mOpenCounter == 0) {
                // Closing database
                dbInstance.close();

            }
        }

        public static final int DATABASE_VERSION = 1;
        public static final String DATABASE_NAME = "scoreUp";
        public static final String TABLE_LEARNARTICLES = "learn_articles";

        public static final String ARTICLE_CODE = "article_code";
        public static final String ARTICLE_SHORT_DESC = "article_short_desc";
        public static final String ARTICLE_DATE = "article_date";
        public static final String ARTICLE_NO_OF_SHARES = "article_no_of_shares";
        public static final String ARTICLE_NO_OF_CHALLENGES = "article_no_of_challenges";
        public static final String ARTICLE_AUTHOR = "article_author";
        public static final String ARTICLE_LONG_DESCRIPTION = "article_long_desc";
        public static final String ARTICLE_IMAGE_URL = "article_image_url";
        public static final String ARTICLE_SHARE_URL = "article_share_url";


        @Override
        public void onCreate(SQLiteDatabase db) {
            // TODO Auto-generated method stub
            String mCreateAritcleTable = "CREATE TABLE " + TABLE_LEARNARTICLES
                    + " (_id INTEGER PRIMARY KEY AUTOINCREMENT, " + ARTICLE_CODE
                    + " TEXT, " + ARTICLE_SHORT_DESC + " TEXT, " + ARTICLE_DATE
                    + " TEXT," + ARTICLE_NO_OF_SHARES + " INTEGER, "
                    + ARTICLE_NO_OF_CHALLENGES + " INTEGER, " + ARTICLE_AUTHOR
                    + " TEXT, " + ARTICLE_LONG_DESCRIPTION + " TEXT, "
                    + ARTICLE_IMAGE_URL + " TEXT, " + ARTICLE_SHARE_URL + " TEXT);";
            db.execSQL(mCreateAritcleTable);
}
4

0 回答 0