Android 4.4上的IBM Worklight 6.1 JsonStore问题

时间:2013-12-10 09:50:41

标签: ibm-mobilefirst jsonstore

我已升级到Worklight 6.1&我期待我在这里提到的问题IBM Worklight Android 4.4 issue, JSON Store stopped working将得到解决,我的应用程序现在应该可以正常工作。但仍面临Android 4.4中的JSONStore初始化问题。请检查下面的日志。

12-10 14:58:30.630: D/dalvikvm(14826): No JNI_OnLoad found in /data/app-lib/com.Test-2/libsqlcipher_android.so 0x41e371b0, skipping init
12-10 14:58:30.630: D/dalvikvm(14826): Trying to load lib /data/app-lib/com.Test-2/libdatabase_sqlcipher.so 0x41e371b0
12-10 14:58:30.630: W/linker(14826): libdatabase_sqlcipher.so has text relocations. This is wasting memory and is a security risk. Please fix.
12-10 14:58:30.630: E/dalvikvm(14826): dlopen("/data/app-lib/com.Test-2/libdatabase_sqlcipher.so") failed: dlopen failed: cannot locate symbol "_ZN7android10MemoryBaseC1ERKNS_2spINS_11IMemoryHeapEEElj" referenced by "libdatabase_sqlcipher.so"...
12-10 14:58:30.640: E/jsonstore-core(14826): Error during provision
12-10 14:58:30.640: E/jsonstore-core(14826): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN7android10MemoryBaseC1ERKNS_2spINS_11IMemoryHeapEEElj" referenced by "libdatabase_sqlcipher.so"...
12-10 14:58:30.640: E/jsonstore-core(14826):    at java.lang.Runtime.loadLibrary(Runtime.java:364)
12-10 14:58:30.640: E/jsonstore-core(14826):    at java.lang.System.loadLibrary(System.java:526)
12-10 14:58:30.640: E/jsonstore-core(14826):    at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:144)
12-10 14:58:30.640: E/jsonstore-core(14826):    at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:137)
12-10 14:58:30.640: E/jsonstore-core(14826):    at com.worklight.androidgap.jsonstore.database.DatabaseManager.openDatabaseIfNecessary(DatabaseManager.java:173)
12-10 14:58:30.640: E/jsonstore-core(14826):    at com.worklight.androidgap.jsonstore.database.DatabaseManager.checkDatabaseAgainstSchema(DatabaseManager.java:87)
12-10 14:58:30.640: E/jsonstore-core(14826):    at com.worklight.androidgap.plugin.storage.ProvisionActionDispatcher.isSchemaMismatched(ProvisionActionDispatcher.java:155)
12-10 14:58:30.640: E/jsonstore-core(14826):    at com.worklight.androidgap.plugin.storage.ProvisionActionDispatcher.dispatch(ProvisionActionDispatcher.java:293)
12-10 14:58:30.640: E/jsonstore-core(14826):    at com.worklight.androidgap.plugin.storage.BaseActionDispatcher.dispatch(BaseActionDispatcher.java:87)
12-10 14:58:30.640: E/jsonstore-core(14826):    at com.worklight.androidgap.plugin.storage.DispatchingPlugin$ActionDispatcherRunnable.run(DispatchingPlugin.java:113)
12-10 14:58:30.640: E/jsonstore-core(14826):    at com.worklight.androidgap.plugin.storage.DispatchingPlugin$SerialExecutor$1.run(DispatchingPlugin.java:147)
12-10 14:58:30.640: E/jsonstore-core(14826):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
12-10 14:58:30.640: E/jsonstore-core(14826):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
12-10 14:58:30.640: E/jsonstore-core(14826):    at java.lang.Thread.run(Thread.java:841)
12-10 14:58:30.650: E/Test(14826): init notification error:----->{
12-10 14:58:30.650: E/Test(14826):  "src": "initCollection",
12-10 14:58:30.650: E/Test(14826):  "err": -1,
12-10 14:58:30.650: E/Test(14826):  "msg": "PERSISTENT_STORE_FAILURE",
12-10 14:58:30.650: E/Test(14826):  "col": "Notification",
12-10 14:58:30.650: E/Test(14826):  "usr": "TestUser",
12-10 14:58:30.650: E/Test(14826):  "doc": {},
12-10 14:58:30.650: E/Test(14826):  "res": {}
12-10 14:58:30.650: E/Test(14826): }
12-10 14:58:30.660: E/Test(14826): [wl.jsonstore] {"src":"initCollection","err":-1,"msg":"PERSISTENT_STORE_FAILURE","col":"Notification","usr":"TestUser","doc":{},"res":{}}

2 个答案:

答案 0 :(得分:3)

请尝试以下操作:

  • 卸载应用程序(只是为了确保没有缓存任何内容)
  • 转到application-descriptor.xml
  • 删除JSONStore可选功能
  • 构建
  • 确保从Android环境下的armeabi/libdatabase_sqlite.so文件夹中删除x86/libdatabase_sqlcipher.sosqlcipher.jarnative。请参阅下面的您关注的文件下的图片。
  • 转到application-descriptor.xml
  • 启用JSONStore可选功能
  • 构建
  • 确保armeabi/libdatabase_sqlite.sox86/libdatabase_sqlcipher.sosqlcipher.jar返回。请查看 FYI 部分了解更多详情。
  • 在Eclipse上刷新原生Android项目。
  • 在模拟器或设备上运行。

FYI

我的机器(Mac OSX 10.9)上的工作库的大小和MD5哈希值。大小由ls -al确定,MD5哈希是使用md5 [file]生成的。

<强> sqlcipher.jar

Size: 103300 
MD5 Hash: 8d7f4d682994158096763c24e3d79fb2 

<强> armeabi / libdatabase_sqlite.so

Size: 365644
MD5 Hash: 07c4cf69d038c3fdcc7dd0490841ea3d

<强> 86 / libdatabase_sqlcipher.so

Size: 367020
MD5 Hash: 38756d70d256f8e5982ed9789705457f

您关注的文件:

Files

仍然无效?

  • 使用v6.1创建一个新的Worklight项目(不适用于其他版本)。
  • 创建新的混合应用程序。
  • 创建Android环境。
  • 转到application-descriptor.xml
  • 启用JSONStore。
  • 构建
  • 确认JSONStore在那里工作。

这是一个简单的例子:

var collections = {
    customers : {
      searchFields : {
        'CUSTOMERCODE' : 'string'
      }
    }
  };

  WL.JSONStore.init(collections)

  .then(function () {
    return WL.JSONStore.get('customers').add({'CUSTOMERCODE' : '456'});
  })

  .then(function () {
    return WL.JSONStore.get('customers').findAll();
  })

  .then(function (res) {
    alert(JSON.stringify(res));
  })

  .fail(function (err) {
    alert(err.toString());
  });
});
  • 将新版本的适用于Android v4.4的项目中的armeabi/libdatabase_sqlite.sox86/libdatabase_sqlcipher.sosqlcipher.jar复制到现有项目中。在将其发送到设备或模拟器之前,请确保构建,卸载以前版本的应用程序并刷新本机项目。

答案 1 :(得分:1)

我正在运行一个过时的lib版本。使用2.2.2对我来说是4.4。 从here下载