数据库
首页 > 数据库> > android – 安装时应用程序崩溃,错误sqlite3_exec – 无法设置同步模式= 1(正常)

android – 安装时应用程序崩溃,错误sqlite3_exec – 无法设置同步模式= 1(正常)

作者:互联网

我在Android Note 4.0.4上使用Samsung Note运行我的应用程序.

它不会像运行Android 2.2的Samsung POP这样的设备崩溃.在摩托罗拉Xoom上运行Androi 3.1.

当我安装我的应用程序它显示黑屏然后一段时间后显示弹出窗口应用程序停止,并且我的应用程序启动屏幕加载在此对话框后面,当我按下确定对话框消失,我可以转到我的应用程序登录屏幕.

12-13 18:33:53.823: I/ActivityThread(14608): Pub com.android.mypype.urbanairship.provider: com.urbanairship.UrbanAirshipProvider
12-13 18:33:53.833: I/Inside MyPype(14608):  Application Class
12-13 18:33:54.423: D/myPype - UALib(14608): Airship Take Off! Lib Version: 2.0.1 / App key = xsXcmKOoRe6gog9onrQHjA
12-13 18:33:54.423: D/myPype - UALib(14608): In Production? false
12-13 18:33:54.713: D/myPype - UALib(14608): Initializing Push.
12-13 18:33:54.718: D/myPype - UALib(14608): Initializing Analytics.
12-13 18:33:54.938: I/SqliteDatabaseCpp(14608): sqlite returned: error code = 5, msg = database is locked, db=xxx

    12-12 11:57:09.553: E/SqliteDatabaseCpp(3608): sqlite3_exec - Failed to set synchronous mode = 1(Normal) 
    12-12 11:57:09.553: E/SQLiteDatabase(3608): Failed to open the database. closing it.
    12-12 11:57:09.553: E/SQLiteDatabase(3608): android.database.sqlite.SQLiteDatabaseLockedException: database is locked
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at android.database.sqlite.SQLiteDatabase.dbopen(Native Method)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1132)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1083)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1170)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:844)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:228)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:157)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at com.urbanairship.analytics.EventDataManager.<init>(Unknown Source)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at com.urbanairship.analytics.Analytics.<init>(Unknown Source)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at com.urbanairship.UAirship.takeOff(Unknown Source)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at com.android.mypype.MypypeApplication.onCreate(MypypeApplication.java:133)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:972)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3965)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at android.app.ActivityThread.access$1300(ActivityThread.java:127)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at android.os.Handler.dispatchMessage(Handler.java:99)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at android.os.Looper.loop(Looper.java:137)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at android.app.ActivityThread.main(ActivityThread.java:4511)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at java.lang.reflect.Method.invokeNative(Native Method)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at java.lang.reflect.Method.invoke(Method.java:511)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
    12-12 11:57:09.553: E/SQLiteDatabase(3608):     at dalvik.system.NativeStart.main(Native Method)
    12-12 11:57:09.553: E/myPype - UALib(3608): Unable to open Analytics Event DB


    12-12 11:57:37.958: E/myPype - UALib(3608): Unable to get DB size. Database not open.
    12-12 11:57:37.963: E/myPype - UALib(3608): Unable to insert event. Database not open.

在上面的错误中,为什么它指向Application类Urbanairship.takeOff()方法.

我正在寻找这个问题,但还没有得到任何东西.我无法理解.我尝试在openHelper calss中同步锁定数据库操作.

任何帮助将不胜感激.

在我的Application类中,我为Urbanairship添加了以下代码.

  @Override
public void onCreate() {
    // TODO Auto-generated method stub
    super.onCreate();
// This can be done in code as illustrated here,
        // or you can add these settings to a properties file
        // called airshipconfig.properties
        // and place it in your "assets" folder
        AirshipConfigOptions options = AirshipConfigOptions
                .loadDefaultOptions(this);

         // Take off initializes the services


        UAirship.takeOff(this, options);

        PushManager.enablePush();
}

解决方法:

我弄明白了,但不是解决方案,它只是一个修复.
 我只是处理异常,所以应用程序不会崩溃.

多么难过没有人经历过这种情况实际上它适用于更高版本,如4.0.4.
所以,我有一件事可能是Urbairships新的lib.错误,因为它试图写数据库(我读了一些事件或东西).

我不明白如何解决所以我处理了这个异常.

因此,解决方案是您必须在try-catch块下编写代码并指定catch中的处理异常.

标签:urbanairship-com,android,android-sqlite
来源: https://codeday.me/bug/20190928/1825336.html