我们在原生Android应用程序中使用Worklight JSONStore。
每当我们第一次安装应用程序时,应用程序都会崩溃 - 第二次打开它后不会崩溃。
我们能够找到日志并发现问题出在sqlite(JSONStore)中 我们在下面添加了日志。
01-20 10:03:27.682: W/ActivityThread(23197): Application com.MeaWallet can be debugged on port 8100...
01-20 10:03:27.802: D/webcoreglue(23197): netstack: Memory Cache feature is ON
01-20 10:03:28.002: D/JSENGINE(23197): qualcomm.jsengine.version:C.2-patch35-git:7b7ad6f
01-20 10:03:28.022: I/TAG(23197): **************** File /data/data/APP_PACKAGE/cache DELETED *******************
01-20 10:03:28.022: I/TAG(23197): **************** File /data/data/APP_PACKAGE/files DELETED *******************
01-20 10:03:28.022: I/TAG(23197): **************** File /data/data/APP_PACKAGE/app___WL_EVENTS DELETED *******************
01-20 10:03:28.032: I/TAG(23197): **************** File /data/data/APP_PACKAGE/databases DELETED *******************
01-20 10:03:28.032: I/TAG(23197): **************** File /data/data/APP_PACKAGE/shared_prefs DELETED *******************
01-20 10:03:28.032: E/SQLiteLog(23197): (1802) os_unix.c:30033: (2) stat(/data/data/com.MeaWallet/databases/webview.db) -
01-20 10:03:28.032: E/SQLiteLog(23197): (1802) statement aborts at 9: [CREATE TABLE formurl (_id INTEGER PRIMARY KEY, url TEXT);]
01-20 10:03:28.032: E/SQLiteLog(23197): (1) statement aborts at 2: [ROLLBACK;] cannot rollback - no transaction is active
01-20 10:03:28.032: W/dalvikvm(23197): threadid=13: thread exiting with uncaught exception (group=0x415b68b0)
01-20 10:03:28.082: E/AndroidRuntime(23197): FATAL EXCEPTION: Thread-9715
01-20 10:03:28.082: E/AndroidRuntime(23197): android.database.sqlite.SQLiteException: cannot rollback - no transaction is active (code 1)
01-20 10:03:28.082: E/AndroidRuntime(23197): at android.database.sqlite.SQLiteConnection.nativeExecute(Native Method)
01-20 10:03:28.082: E/AndroidRuntime(23197): at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:555)
01-20 10:03:28.082: E/AndroidRuntime(23197): at android.database.sqlite.SQLiteSession.endTransactionUnchecked(SQLiteSession.java:439)
01-20 10:03:28.082: E/AndroidRuntime(23197): at android.database.sqlite.SQLiteSession.endTransaction(SQLiteSession.java:401)
01-20 10:03:28.082: E/AndroidRuntime(23197): at android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java:530)
01-20 10:03:28.082: E/AndroidRuntime(23197): at android.webkit.WebViewDatabaseClassic.initDatabase(WebViewDatabaseClassic.java:165)
01-20 10:03:28.082: E/AndroidRuntime(23197): at android.webkit.WebViewDatabaseClassic.init(WebViewDatabaseClassic.java:130)
01-20 10:03:28.082: E/AndroidRuntime(23197): at android.webkit.WebViewDatabaseClassic.access$000(WebViewDatabaseClassic.java:35)
01-20 10:03:28.082: E/AndroidRuntime(23197): at android.webkit.WebViewDatabaseClassic$1.run(WebViewDatabaseClassic.java:109)
01-20 10:03:28.092: E/com.worklight.common.Logger$UncaughtExceptionHandler(23197): Logger$UncaughtExceptionHandler.uncaughtException in Logger.java:400 :: Uncaught Exception
01-20 10:03:28.092: E/com.worklight.common.Logger$UncaughtExceptionHandler(23197): android.database.sqlite.SQLiteException: cannot rollback - no transaction is active (code 1)
01-20 10:03:28.092: E/com.worklight.common.Logger$UncaughtExceptionHandler(23197): at android.database.sqlite.SQLiteConnection.nativeExecute(Native Method)
01-20 10:03:28.092: E/com.worklight.common.Logger$UncaughtExceptionHandler(23197): at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:555)
01-20 10:03:28.092: E/com.worklight.common.Logger$UncaughtExceptionHandler(23197): at android.database.sqlite.SQLiteSession.endTransactionUnchecked(SQLiteSession.java:439)
01-20 10:03:28.092: E/com.worklight.common.Logger$UncaughtExceptionHandler(23197): at android.database.sqlite.SQLiteSession.endTransaction(SQLiteSession.java:401)
01-20 10:03:28.092: E/com.worklight.common.Logger$UncaughtExceptionHandler(23197): at android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java:530)
01-20 10:03:28.092: E/com.worklight.common.Logger$UncaughtExceptionHandler(23197): at android.webkit.WebViewDatabaseClassic.initDatabase(WebViewDatabaseClassic.java:165)
01-20 10:03:28.092: E/com.worklight.common.Logger$UncaughtExceptionHandler(23197): at android.webkit.WebViewDatabaseClassic.init(WebViewDatabaseClassic.java:130)
01-20 10:03:28.092: E/com.worklight.common.Logger$UncaughtExceptionHandler(23197): at android.webkit.WebViewDatabaseClassic.access$000(WebViewDatabaseClassic.java:35)
01-20 10:03:28.092: E/com.worklight.common.Logger$UncaughtExceptionHandler(23197): at android.webkit.WebViewDatabaseClassic$1.run(WebViewDatabaseClassic.java:109)
01-20 10:03:28.112: D/com.worklight.nativeandroid.common.WLUtils(23197): WLUtils.loadLib in WLUtils.java:533 :: Extracting zip file: featurelibs/armeabi/libcrypto.so.1.0.0
01-20 10:03:28.152: D/HostStatisticManager(23197): netstack: DNS Host Prioritization is: ON, Version: 5.0.1
01-20 10:03:28.152: I/(23197): netstack: LIB_MGR - Lib loaded: libdnshostprio.so
01-20 10:03:28.152: I/(23197): netstack: STAT_HUB - Succeeded to load plugin: libdnshostprio.so
01-20 10:03:28.152: E/(23197): netstack: LIB_MGR - Error loading lib spl_proc_plugin.so
01-20 10:03:28.152: E/(23197): netstack: STAT_HUB - Failed to load plugin: spl_proc_plugin.so
01-20 10:03:28.152: I/(23197): netstack: LIB_MGR - Lib loaded: pp_proc_plugin.so
01-20 10:03:28.152: I/(23197): netstack: STAT_HUB - Succeeded to load plugin: pp_proc_plugin.so
01-20 10:03:28.152: E/(23197): netstack: STAT_HUB - App com.MeaWallet isn't supported
01-20 10:03:28.273: D/dalvikvm(23197): Trying to load lib /data/data/com.MeaWallet/files/libcrypto.so.1.0.0 0x4185f6a8
01-20 10:03:28.273: D/dalvikvm(23197): Added shared lib /data/data/com.MeaWallet/files/libcrypto.so.1.0.0 0x4185f6a8
01-20 10:03:28.273: D/dalvikvm(23197): No JNI_OnLoad found in /data/data/com.MeaWallet/files/libcrypto.so.1.0.0 0x4185f6a8, skipping init
01-20 10:03:28.273: D/com.worklight.nativeandroid.common.WLUtils(23197): WLUtils.loadLib in WLUtils.java:541 :: Loading library using System.load: /data/data/com.MeaWallet/files/libcrypto.so.1.0.0
01-20 10:03:28.303: D/dalvikvm(23197): Trying to load lib /data/app-lib/com.MeaWallet-1/libstlport_shared.so 0x4185f6a8
01-20 10:03:28.303: D/dalvikvm(23197): Added shared lib /data/app-lib/com.MeaWallet-1/libstlport_shared.so 0x4185f6a8
01-20 10:03:28.303: D/dalvikvm(23197): No JNI_OnLoad found in /data/app-lib/com.MeaWallet-1/libstlport_shared.so 0x4185f6a8, skipping init
01-20 10:03:28.303: D/dalvikvm(23197): Trying to load lib /data/app-lib/com.MeaWallet-1/libsqlcipher_android.so 0x4185f6a8
01-20 10:03:28.303: D/dalvikvm(23197): Added shared lib /data/app-lib/com.MeaWallet-1/libsqlcipher_android.so 0x4185f6a8
01-20 10:03:28.303: D/dalvikvm(23197): No JNI_OnLoad found in /data/app-lib/com.MeaWallet-1/libsqlcipher_android.so 0x4185f6a8, skipping init
01-20 10:03:28.303: D/dalvikvm(23197): Trying to load lib /data/app-lib/com.MeaWallet-1/libdatabase_sqlcipher.so 0x4185f6a8
01-20 10:03:28.303: D/dalvikvm(23197): Added shared lib /data/app-lib/com.MeaWallet-1/libdatabase_sqlcipher.so 0x4185f6a8
01-20 10:03:28.303: I/Database(23197): JNI_OnLoad called
01-20 10:03:28.303: I/Database(23197): JNI_OnLoad register methods
01-20 10:03:29.334: D/JSONSTORE(23197): JSONStoreLogger.logDebug in JSONStoreLogger.java:174 :: provisioning database "user" (already exists: false)
01-20 10:03:29.394: D/JSONSTORE(23197): JSONStoreLogger.logDebug in JSONStoreLogger.java:174 :: provisioning database "mktMsg" (already exists: false)
01-20 10:03:29.454: D/JSONSTORE(23197): JSONStoreLogger.logDebug in JSONStoreLogger.java:174 :: provisioning database "simplytapp" (already exists: false)
01-20 10:03:31.126: D/JSONSTORE(23197): JSONStoreLogger.logDebug in JSONStoreLogger.java:174 :: provisioning database "event" (already exists: false)
01-20 10:03:31.186: D/JSONSTORE(23197): JSONStoreLogger.logDebug in JSONStoreLogger.java:174 :: provisioning database "widget" (already exists: false)
01-20 10:03:31.256: D/JSONSTORE(23197): JSONStoreLogger.logDebug in JSONStoreLogger.java:174 :: provisioning database "receiptList" (already exists: false)
01-20 10:03:31.316: V/DeviceInfoManager(23197): DeviceInfo is: {"device_properties":[{"data":{"product":"C5303","device":"C5303","model":"C5303","hardware":"qcom","manufacturer":"Sony"},"available":true,"name":"device"},{"data":{"version":"18","name":"Android"},"available":true,"name":"os"},{"available":true,"name":"camera"},{"available":false,"name":"hce"},{"data":{"mac_address":"44:d4:e0:3c:d9:36"},"available":true,"name":"wifi"},{"available":false,"name":"credenSE"}]}
01-20 10:03:31.366: W/HomeActivity(23197): HomeActivity.java DESTROYED!
01-20 10:03:31.376: D/WLClient(23197): WLClient.createInstance in WLClient.java:169 :: WLClient has already been created.
01-20 10:03:31.406: W/com.worklight.wlclient.api.WLPush(23197): WLPush.unregisterReceivers in WLPush.java:763 :: unregisterReceivers:Receiver not registered: com.worklight.wlclient.api.WLPush$3@41c11b40
01-20 10:03:31.406: V/WalletServerManager(23197): Set challenge handler to MwChallengeHandler
01-20 10:03:31.406: W/com.worklight.wlclient.api.WLPush(23197): WLPush.unregisterReceivers in WLPush.java:768 :: unregisterReceivers:Receiver not registered: com.worklight.wlclient.api.WLPush$4@41c11df8
01-20 10:03:31.426: W/com.worklight.wlclient.api.WLPush(23197): WLPush.unregisterReceivers in WLPush.java:773 :: unregisterReceivers:Receiver not registered: com.worklight.wlclient.api.WLPush$5@41c120b0
相关代码段(来自以下评论):
List<JSONStoreCollection> collections = new ArrayList<JSONStoreCollection>();
uRDao = new UserInfoDao();
JSONStoreCollection userStore = userDao.getJsonStoreCollection();
collections.add(userStore);
MMDao = new MarketMessageDao();
JSONStoreCollection MMStore = MMDao.getJsonStoreCollection();
collections.add(marketMessageStore);
WLJSONStore.getInstance(application).openCollections(collections);
代码在初始化时失败了。
public class EventDao extends BaseDao<EventPojo> {
public EventDao() {
super(EventPojo.class);
}
@Override
public JSONStoreCollection getJsonStoreCollection() {
try {
store = new JSONStoreCollection("event");
} catch (JSONStoreInvalidSchemaException e) {
Log.e(getClass().getSimpleName(), "Exception " + Util.printException(e));
return null;
}
return store;
}
}
答案 0 :(得分:0)
BalajiG和Rahul Hawge没有回复评论。 他们这样解决了这个问题:
是的,通过在jsonStores中添加检查来进行一些代码更改 创建。它停止了崩溃。