关于Android 4.4的IBM Worklight 6.1 JsonStore问题

时间:2021-09-24 00:07:34

I have upgraded to Worklight 6.1 & I was with expectation that the issue I mentioned here IBM Worklight Android 4.4 issue, JSON Store stopped working would be resolved and my app should work fine now. But still facing the JSONStore initialization issue in Android 4.4. Please check below log.

我已经升级到Worklight 6.1 &我期望我在这里提到的IBM Worklight Android 4.4问题,JSON Store停止工作将得到解决,我的app现在应该可以正常工作了。但在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 个解决方案

#1


3  

Try the following:

试试以下:

  • Uninstall the application (just to make sure nothing is being cached)
  • 卸载应用程序(确保没有缓存)
  • Go to the application-descriptor.xml
  • 去application-descriptor.xml
  • Remove the JSONStore optional feature
  • 删除JSONStore可选特性
  • Build
  • 构建
  • Make sure armeabi/libdatabase_sqlite.so, x86/libdatabase_sqlcipher.so and sqlcipher.jar are removed from the native folder under your Android environment. See the picture below under Files you care about.
  • 确保armeabi / libdatabase_sqlite。所以,x86 / libdatabase_sqlcipher。所以,sqlcipher。jar从Android环境下的本机文件夹中删除。在你关心的文件下面看到图片。
  • Go to application-descriptor.xml
  • 去application-descriptor.xml
  • Enable the JSONStore optional feature
  • 启用JSONStore可选特性
  • Build
  • 构建
  • Make sure armeabi/libdatabase_sqlite.so, x86/libdatabase_sqlcipher.so and sqlcipher.jar are back. Look at the FYI section for more details.
  • 确保armeabi / libdatabase_sqlite。所以,x86 / libdatabase_sqlcipher。所以,sqlcipher。jar又回来了。有关更多细节,请参阅参考资料部分。
  • Refresh the native Android project on Eclipse.
  • 在Eclipse上刷新本机Android项目。
  • Run on an emulator or device.
  • 在模拟器或设备上运行。

FYI

仅供参考

The size and MD5 hashes on my machine (Mac OSX 10.9) for the working libraries. Size was determined with ls -al and the MD5 hash was generated with md5 [file].

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

sqlcipher.jar

sqlcipher.jar

Size: 103300 
MD5 Hash: 8d7f4d682994158096763c24e3d79fb2 

armeabi/libdatabase_sqlite.so

armeabi / libdatabase_sqlite.so

Size: 365644
MD5 Hash: 07c4cf69d038c3fdcc7dd0490841ea3d

x86/libdatabase_sqlcipher.so

x86 / libdatabase_sqlcipher.so

Size: 367020
MD5 Hash: 38756d70d256f8e5982ed9789705457f

The files you care about:

你关心的文件:

关于Android 4.4的IBM Worklight 6.1 JsonStore问题

Still not working?

还不工作吗?

  • Create a new Worklight Project with v6.1 (won't work with other versions).
  • 使用v6.1创建一个新的Worklight项目(不会与其他版本一起使用)。
  • Create a new Hybrid Application.
  • 创建一个新的混合应用程序。
  • Create an Android environments.
  • 创建一个Android环境。
  • Go to the application-descriptor.xml
  • 去application-descriptor.xml
  • Enable JSONStore.
  • 启用JSONStore。
  • Build.
  • 构建。
  • Confirm JSONStore works there.
  • 确认JSONStore作品。

Here's a quick example:

这里有一个简单的例子:

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());
  });
});
  • Copy armeabi/libdatabase_sqlite.so, x86/libdatabase_sqlcipher.so and sqlcipher.jar from that newly created project that works in Android v4.4 to your existing project. Make sure you build, uninstall a previous version of the app and refresh the native project before you send it to the device or emulator.
  • armeabi / libdatabase_sqlite副本。所以,x86 / libdatabase_sqlcipher。所以,sqlcipher。在Android v4.4中工作的新创建项目jar到您的现有项目。在将应用程序发送到设备或模拟器之前,请确保构建、卸载以前的应用程序版本并刷新本机项目。

#2


1  

I'm was running an out-dated version of the lib. Using 2.2.2 works on 4.4 for me. Download from here

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

#1


3  

Try the following:

试试以下:

  • Uninstall the application (just to make sure nothing is being cached)
  • 卸载应用程序(确保没有缓存)
  • Go to the application-descriptor.xml
  • 去application-descriptor.xml
  • Remove the JSONStore optional feature
  • 删除JSONStore可选特性
  • Build
  • 构建
  • Make sure armeabi/libdatabase_sqlite.so, x86/libdatabase_sqlcipher.so and sqlcipher.jar are removed from the native folder under your Android environment. See the picture below under Files you care about.
  • 确保armeabi / libdatabase_sqlite。所以,x86 / libdatabase_sqlcipher。所以,sqlcipher。jar从Android环境下的本机文件夹中删除。在你关心的文件下面看到图片。
  • Go to application-descriptor.xml
  • 去application-descriptor.xml
  • Enable the JSONStore optional feature
  • 启用JSONStore可选特性
  • Build
  • 构建
  • Make sure armeabi/libdatabase_sqlite.so, x86/libdatabase_sqlcipher.so and sqlcipher.jar are back. Look at the FYI section for more details.
  • 确保armeabi / libdatabase_sqlite。所以,x86 / libdatabase_sqlcipher。所以,sqlcipher。jar又回来了。有关更多细节,请参阅参考资料部分。
  • Refresh the native Android project on Eclipse.
  • 在Eclipse上刷新本机Android项目。
  • Run on an emulator or device.
  • 在模拟器或设备上运行。

FYI

仅供参考

The size and MD5 hashes on my machine (Mac OSX 10.9) for the working libraries. Size was determined with ls -al and the MD5 hash was generated with md5 [file].

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

sqlcipher.jar

sqlcipher.jar

Size: 103300 
MD5 Hash: 8d7f4d682994158096763c24e3d79fb2 

armeabi/libdatabase_sqlite.so

armeabi / libdatabase_sqlite.so

Size: 365644
MD5 Hash: 07c4cf69d038c3fdcc7dd0490841ea3d

x86/libdatabase_sqlcipher.so

x86 / libdatabase_sqlcipher.so

Size: 367020
MD5 Hash: 38756d70d256f8e5982ed9789705457f

The files you care about:

你关心的文件:

关于Android 4.4的IBM Worklight 6.1 JsonStore问题

Still not working?

还不工作吗?

  • Create a new Worklight Project with v6.1 (won't work with other versions).
  • 使用v6.1创建一个新的Worklight项目(不会与其他版本一起使用)。
  • Create a new Hybrid Application.
  • 创建一个新的混合应用程序。
  • Create an Android environments.
  • 创建一个Android环境。
  • Go to the application-descriptor.xml
  • 去application-descriptor.xml
  • Enable JSONStore.
  • 启用JSONStore。
  • Build.
  • 构建。
  • Confirm JSONStore works there.
  • 确认JSONStore作品。

Here's a quick example:

这里有一个简单的例子:

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());
  });
});
  • Copy armeabi/libdatabase_sqlite.so, x86/libdatabase_sqlcipher.so and sqlcipher.jar from that newly created project that works in Android v4.4 to your existing project. Make sure you build, uninstall a previous version of the app and refresh the native project before you send it to the device or emulator.
  • armeabi / libdatabase_sqlite副本。所以,x86 / libdatabase_sqlcipher。所以,sqlcipher。在Android v4.4中工作的新创建项目jar到您的现有项目。在将应用程序发送到设备或模拟器之前,请确保构建、卸载以前的应用程序版本并刷新本机项目。

#2


1  

I'm was running an out-dated version of the lib. Using 2.2.2 works on 4.4 for me. Download from here

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