【发布时间】:2015-06-14 05:14:36
【问题描述】:
我有一个使用 MobileFirst Platform 7 创建的混合应用程序,它可以在许多物理 Android 设备、AVD 以及 MFP 控制台预览/模拟器上完美运行。在所有情况下,设备和 AVD 都运行 KitKat (v4.4.4)。
为了信息的持久性,我使用 JSONStore Javascript API。
但是,在单个设备上(松下 Toughpad FZ-B2)。 JSONstore 拒绝初始化,并且在尝试初始化集合时会抛出 PERSISTENT_STORE_FAILURE 失败。
相信这可能是我的代码,我从MFP Developer Center 下载、编译并安装了示例 JSONStore JavaScript API 项目。
我将它安装到所有设备(三星 Galaxy Tab2、索尼 Xperia Z3、THL T6S 和 Toughpad)。在所有设备上,应用程序运行良好,但在 ToughPad 上,我再次收到 PERSISTENT_STORE_FAILURE。
我该怎么做才能调查/解决原因?
错误截图以及我认为是设备上的相关信息:http://files.interestingmix.com.au/stack/toughpadJSON.png
我已经尝试编译 API 级别 19 和 22 的 apk,但行为没有差异(在它工作的设备上,它总是工作,但硬板不合作)
更新
我已经能够将设备上的运行时从 Dalvik(旧)更改为 ART(新),现在抛出的错误是 OPERATION_FAILED_ON_SPECIFIC_DOCUMENT(在入门应用程序中的相同位置(在底部),所以需要新的另一个屏幕截图),我现在正在调查
更新 2(使用 Toughpad 结果修订)
我终于能够获得到 Toughpad 设备的 ADB 连接,因此获得了 LogCat。该错误似乎与尝试打开 libcrypto.so.1.0.0 有关。据我所知,特定运行时的包中不存在所需的库文件。 (请注意,我已将设备恢复到在 Dalvik 上运行,因为这应该是 KitKat 更稳定和受支持的基础)
这可能与 Tougpad 设备(我怀疑)是 x86_64 位运行时有关,因此未提供库吗?我们如何检查/解决这个问题?
Logcat输出如下:
04-10 05:02:31.810: D/dalvikvm(6889): Late-enabling CheckJNI
04-10 05:02:31.810: D/dalvikvm(6889): Try to disable coredump for pid 6889
04-10 05:02:31.810: D/dalvikvm(6889): Process 6889 nice name: com.JSONStoreAPI
04-10 05:02:31.810: D/dalvikvm(6889): Extra Options: not specified
04-10 05:02:31.830: E/jdwp(6889): Failed sending reply to debugger: Broken pipe
04-10 05:02:31.830: D/dalvikvm(6889): Debugger has detached; object registry had 1 entries
04-10 05:02:31.840: I/CordovaLog(6889): Changing log level to DEBUG(3)
04-10 05:02:31.850: W/WLClient(6889): WLClient.createInstance in WLClient.java:220 :: You should pass a context that is assignable from the Activity class. WLClient instance may be used to start an activity.
04-10 05:02:31.900: D/wl.splashscreen(6889): WLSplashScreen.show in WLSplashScreen.java:64 :: Showing Splash Screen
04-10 05:02:31.910: D/CordovaActivity(6889): Resuming the App
04-10 05:02:31.910: D/WLClient(6889): WLClient$ActivityListener.onActivityStarted in WLClient.java:1434 :: on activity started com.JSONStoreAPI.JSONStoreAPI
04-10 05:02:31.920: D/WLClient(6889): WLClient$ActivityListener.onActivityResumed in WLClient.java:1423 :: on activity resumed com.JSONStoreAPI.JSONStoreAPI . activity count = 1
04-10 05:02:31.920: D/prepackagedAssetManager(6889): PrepackagedAssetsManager.copyPrepackagedAssetsToLocalStorage in PrepackagedAssetsManager.java:68 :: New installation/upgrade detected, copying resources and saving new checksum
04-10 05:02:31.940: I/ufoGralloc(6889): Hello, this is UFO GRALLOC/Intel Corporation
04-10 05:02:31.940: D/(6889): droid_create_context : config id = 5 conf->NativeVisualID=1
04-10 05:02:31.940: D/(6889): Pixel Format : GGL_PIXEL_FORMAT_RGBA_8888
04-10 05:02:31.940: I/(6889): Requested context : GLES 2.0
04-10 05:02:31.950: D/(6889): Pixel Format : GGL_PIXEL_FORMAT_RGBA_8888
04-10 05:02:31.950: D/OpenGLRenderer(6889): Enabling debug mode 0
04-10 05:02:31.950: D/(6889): Pixel Format : GGL_PIXEL_FORMAT_RGBA_8888
04-10 05:02:31.960: D/wl(6889): WL.doPrepareAssetsWork in WL.java:293 :: no need to check web resource integrity
04-10 05:02:32.000: D/CordovaActivity(6889): CordovaActivity.init()
04-10 05:02:32.000: V/WebViewChromiumFactoryProvider(6889): Binding Chromium to main looper Looper (main, tid 1) {26733be0}
04-10 05:02:32.000: I/LibraryLoader(6889): Expected native library version number "",actual native library version number ""
04-10 05:02:32.010: I/chromium(6889): [INFO:library_loader_hooks.cc(116)] Chromium logging enabled: level = 0, default verbosity = 0
04-10 05:02:32.010: I/BrowserStartupController(6889): Initializing chromium process, renderers=0
04-10 05:02:32.020: E/AudioManagerAndroid(6889): BLUETOOTH permission is missing!
04-10 05:02:32.020: D/(6889): Pixel Format : GGL_PIXEL_FORMAT_RGBA_8888
04-10 05:02:32.020: D/(6889): droid_create_context : config id = 1 conf->NativeVisualID=1
04-10 05:02:32.020: D/(6889): Pixel Format : GGL_PIXEL_FORMAT_RGBA_8888
04-10 05:02:32.020: I/(6889): Requested context : GLES 2.0
04-10 05:02:32.050: W/chromium(6889): [WARNING:proxy_service.cc(890)] PAC support disabled because there is no system implementation
04-10 05:02:32.060: D/CordovaWebView(6889): CordovaWebView is running on device made by: PANASONIC
04-10 05:02:32.060: D/CordovaActivity(6889): CordovaActivity.createViews()
04-10 05:02:32.060: D/CordovaWebView(6889): >>> loadUrl(file:///android_asset/www/skinLoader.html)
04-10 05:02:32.060: D/PluginManager(6889): init()
04-10 05:02:32.060: I/dalvikvm(6889): Could not find method android.webkit.CookieManager.setAcceptThirdPartyCookies, referenced from method com.worklight.androidgap.plugin.WLInitializationPlugin.initialize
04-10 05:02:32.060: W/dalvikvm(6889): VFY: unable to resolve virtual method 580: Landroid/webkit/CookieManager;.setAcceptThirdPartyCookies (Landroid/webkit/WebView;Z)V
04-10 05:02:32.060: D/dalvikvm(6889): VFY: replacing opcode 0x6e at 0x001a
04-10 05:02:32.140: D/CordovaWebView(6889): >>> loadUrlNow()
04-10 05:02:32.150: D/SoftKeyboardDetect(6889): Ignore this event
04-10 05:02:32.190: D/CordovaWebViewClient(6889): onPageStarted(file:///android_asset/www/skinLoader.html)
04-10 05:02:32.190: D/CordovaActivity(6889): onMessage(onPageStarted,file:///android_asset/www/skinLoader.html)
04-10 05:02:32.250: D/JsMessageQueue(6889): Set native->JS mode to OnlineEventsBridgeMode
04-10 05:02:32.250: D/CordovaWebViewClient(6889): onPageFinished(file:///android_asset/www/skinLoader.html)
04-10 05:02:32.250: D/CordovaActivity(6889): onMessage(onPageFinished,file:///android_asset/www/skinLoader.html)
04-10 05:02:32.390: V/StatusBar(6889): StatusBar: initialization
04-10 05:02:32.390: V/StatusBar(6889): Executing action: _ready
04-10 05:02:32.400: W/CordovaPlugin(6889): Attempted to send a second callback for ID: StatusBar1173806884
04-10 05:02:32.400: W/CordovaPlugin(6889): Result was: "Invalid action"
04-10 05:02:32.410: D/CordovaActivity(6889): onMessage(spinner,stop)
04-10 05:02:32.450: D/skuwa(6889): Detected device 0F31:14 family 15:9
04-10 05:02:32.760: D/CordovaNetworkManager(6889): Connection Type: wifi
04-10 05:02:32.760: D/CordovaNetworkManager(6889): Connection Extra Info: "eBlueprint-X6-anac2"
04-10 05:02:32.770: D/CordovaNetworkManager(6889): Connection Type: wifi
04-10 05:02:32.770: D/CordovaNetworkManager(6889): Connection Extra Info: "eBlueprint-X6-anac2"
04-10 05:02:32.770: D/CordovaActivity(6889): onMessage(networkconnection,wifi)
04-10 05:02:32.800: W/PluginManager(6889): THREAD WARNING: exec() call to WLApp.writeUserPref blocked the main thread for 22ms. Plugin should use CordovaInterface.getThreadPool().
04-10 05:02:32.810: D/CordovaWebViewClient(6889): onPageStarted(file:///android_asset/www/default/index.html)
04-10 05:02:32.810: D/JsMessageQueue(6889): Set native->JS mode to null
04-10 05:02:32.810: D/CordovaActivity(6889): onMessage(onPageStarted,file:///android_asset/www/default/index.html)
04-10 05:02:32.850: W/chromium(6889): [WARNING:simple_index_file.cc(338)] Could not map Simple Index file.
04-10 05:02:32.850: I/chromium(6889): [INFO:simple_index_file.cc(437)] Simple Cache Index is being restored from disk.
04-10 05:02:32.860: D/JsMessageQueue(6889): Set native->JS mode to OnlineEventsBridgeMode
04-10 05:02:33.200: V/StatusBar(6889): Executing action: _ready
04-10 05:02:33.200: W/CordovaPlugin(6889): Attempted to send a second callback for ID: StatusBar1365464329
04-10 05:02:33.200: W/CordovaPlugin(6889): Result was: "Invalid action"
04-10 05:02:33.200: D/CordovaActivity(6889): onMessage(spinner,stop)
04-10 05:02:33.210: D/CordovaNetworkManager(6889): Connection Type: wifi
04-10 05:02:33.210: D/CordovaNetworkManager(6889): Connection Extra Info: "eBlueprint-X6-anac2"
04-10 05:02:34.260: D/CordovaActivity(6889): onMessage(spinner,stop)
04-10 05:02:37.860: D/CordovaLog(6889): file:///android_asset/www/default/worklight/cordova.js: Line 1171 : deviceready has not fired after 5 seconds.
04-10 05:02:37.860: I/chromium(6889): [INFO:CONSOLE(1171)] "deviceready has not fired after 5 seconds.", source: file:///android_asset/www/default/worklight/cordova.js (1171)
04-10 05:02:37.870: D/CordovaLog(6889): file:///android_asset/www/default/worklight/cordova.js: Line 1164 : Channel not fired: onDOMContentLoaded
04-10 05:02:37.870: I/chromium(6889): [INFO:CONSOLE(1164)] "Channel not fired: onDOMContentLoaded", source: file:///android_asset/www/default/worklight/cordova.js (1164)
04-10 05:03:52.370: D/dalvikvm(6889): Debugger has detached; object registry had 1 entries
04-10 05:03:59.810: D/CordovaActivity(6889): Paused the application!
04-10 05:03:59.810: D/CordovaWebView(6889): Handle the pause
04-10 05:03:59.810: D/WLClient(6889): WLClient$ActivityListener.onActivityPaused in WLClient.java:1416 :: on activity paused com.JSONStoreAPI.JSONStoreAPI . activity count = 0
04-10 05:03:59.880: D/(6889): Surface destroy: ANDROID_NATIVE_WINDOW_MAGIC
04-10 05:03:59.900: D/(6889): Surface destroy: ANDROID_NATIVE_WINDOW_MAGIC
04-10 05:04:00.140: D/WLClient(6889): WLClient$ActivityListener.onActivitySaveInstanceState in WLClient.java:1428 :: on activity save instance state com.JSONStoreAPI.JSONStoreAPI
04-10 05:04:00.140: D/WLClient(6889): WLClient$ActivityListener.onActivityStopped in WLClient.java:1440 :: on activity stopped com.JSONStoreAPI.JSONStoreAPI
04-10 05:04:00.150: D/(6889): Pixel Format : GGL_PIXEL_FORMAT_RGBA_8888
04-10 05:04:01.410: D/(6889): Pixel Format : GGL_PIXEL_FORMAT_RGBA_8888
04-10 05:04:01.410: D/CordovaActivity(6889): Resuming the App
04-10 05:04:01.410: D/WLClient(6889): WLClient$ActivityListener.onActivityStarted in WLClient.java:1434 :: on activity started com.JSONStoreAPI.JSONStoreAPI
04-10 05:04:01.410: D/WLClient(6889): WLClient$ActivityListener.onActivityResumed in WLClient.java:1423 :: on activity resumed com.JSONStoreAPI.JSONStoreAPI . activity count = 1
04-10 05:04:01.440: D/(6889): Pixel Format : GGL_PIXEL_FORMAT_RGBA_8888
04-10 05:04:40.270: I/dalvikvm(6889): Total arena pages for JIT: 11
04-10 05:04:40.290: D/CordovaWebViewClient(6889): onPageFinished(file:///android_asset/www/default/index.html)
04-10 05:04:40.290: D/CordovaActivity(6889): onMessage(onPageFinished,file:///android_asset/www/default/index.html)
04-10 05:04:40.320: D/NONE(6889): ondeviceready event dispatched
04-10 05:04:40.360: D/NONE(6889): wlclient init started
04-10 05:04:40.360: D/NONE(6889): Read cookies: null
04-10 05:04:40.360: D/NONE(6889): CookieMgr read cookies: {}
04-10 05:04:40.370: W/NONE(6889): Note that if your application targets Android 3.0 (API level 11) or higher, WL.OptionsMenu might have no effect, depending on the device.
04-10 05:04:40.410: D/(6889): Surface destroy: ANDROID_NATIVE_WINDOW_MAGIC
04-10 05:04:40.410: D/NONE(6889): before: initOptions.onSuccess
04-10 05:04:40.430: I/dalvikvm(6889): Could not find method com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable, referenced from method com.worklight.wlclient.push.common.GCMClientFactory.useGooglePlayServices
04-10 05:04:40.430: W/dalvikvm(6889): VFY: unable to resolve static method 721: Lcom/google/android/gms/common/GooglePlayServicesUtil;.isGooglePlayServicesAvailable (Landroid/content/Context;)I
04-10 05:04:40.430: D/dalvikvm(6889): VFY: replacing opcode 0x71 at 0x0006
04-10 05:04:40.430: D/GCMClientFactory(6889): GCMClientFactory.useGooglePlayServices in GCMClientFactory.java:42 :: Google Play Services is not used because the play services library is not found. So using the default GCM helper implementation.
04-10 05:04:40.440: D/GCMClientFactory(6889): GCMClientFactory.getInstance in GCMClientFactory.java:28 :: Using GCMHelperClient
04-10 05:04:40.440: W/GCMHelperClient(6889): GCMHelperClient.unregisterReceivers in GCMHelperClient.java:95 :: unregister:Receiver not registered: null
04-10 05:04:40.440: W/GCMHelperClient(6889): GCMHelperClient.unregisterReceivers in GCMHelperClient.java:101 :: unregister:Receiver not registered: null
04-10 05:04:40.450: D/NONE(6889): after: initOptions.onSuccess
04-10 05:04:40.460: D/NONE(6889): added onPause and onResume event handlers
04-10 05:04:40.460: D/NONE(6889): wlclient init success
04-10 05:04:45.360: D/CordovaLog(6889): : Line 0 : event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
04-10 05:04:45.360: I/chromium(6889): [INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source: (0)
04-10 05:04:45.390: D/com.worklight.nativeandroid.common.WLUtils(6889): WLUtils.loadLib in WLUtils.java:545 :: Extracting zip file: featurelibs/armeabi/libcrypto.so.1.0.0
04-10 05:04:45.430: I/dalvikvm(6889): Total arena pages for JIT: 12
04-10 05:04:45.430: I/dalvikvm(6889): Total arena pages for JIT: 13
04-10 05:04:45.430: I/dalvikvm(6889): Total arena pages for JIT: 14
04-10 05:04:45.430: I/dalvikvm(6889): Total arena pages for JIT: 15
04-10 05:04:45.490: D/dalvikvm(6889): Trying to load lib /data/data/com.JSONStoreAPI/files/libcrypto.so.1.0.0 0x4ce6b1d0
04-10 05:04:45.490: D/com.worklight.nativeandroid.common.WLUtils(6889): WLUtils.loadLib in WLUtils.java:555 :: Loading library using System.load: /data/data/com.JSONStoreAPI/files/libcrypto.so.1.0.0
04-10 05:04:45.530: D/houdini(6889): [7174] Loading library(version: 4.0.6.44921 RELEASE)... successfully.
04-10 05:04:45.540: D/dalvikvm(6889): Added shared lib /data/data/com.JSONStoreAPI/files/libcrypto.so.1.0.0 0x4ce6b1d0
04-10 05:04:45.540: D/dalvikvm(6889): No JNI_OnLoad found in /data/data/com.JSONStoreAPI/files/libcrypto.so.1.0.0 0x4ce6b1d0, skipping init
04-10 05:04:45.560: I/NONE(6889): Destroy finished succesfully
04-10 05:04:48.920: D/dalvikvm(6889): GC_FOR_ALLOC freed 2437K, 26% free 7398K/9880K, paused 5ms, total 5ms
04-10 05:04:48.980: D/dalvikvm(6889): Trying to load lib /data/app-lib/com.JSONStoreAPI-1/libstlport_shared.so 0x4ce6b1d0
04-10 05:04:48.980: D/dalvikvm(6889): Added shared lib /data/app-lib/com.JSONStoreAPI-1/libstlport_shared.so 0x4ce6b1d0
04-10 05:04:48.980: D/dalvikvm(6889): No JNI_OnLoad found in /data/app-lib/com.JSONStoreAPI-1/libstlport_shared.so 0x4ce6b1d0, skipping init
04-10 05:04:48.980: D/dalvikvm(6889): Trying to load lib /data/app-lib/com.JSONStoreAPI-1/libsqlcipher_android.so 0x4ce6b1d0
04-10 05:04:48.980: E/dalvikvm(6889): dlopen("/data/app-lib/com.JSONStoreAPI-1/libsqlcipher_android.so") failed: dlopen failed: could not load library "libcrypto.so.1.0.0" needed by "libsqlcipher_android.so"; caused by library "libcrypto.so.1.0.0" not found
04-10 05:04:48.990: E/JSONSTORE(6889): JSONStoreLogger.logError in JSONStoreLogger.java:189 :: Error during provision
04-10 05:04:48.990: E/JSONSTORE(6889): java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libcrypto.so.1.0.0" needed by "libsqlcipher_android.so"; caused by library "libcrypto.so.1.0.0" not found
04-10 05:04:48.990: E/JSONSTORE(6889): at java.lang.Runtime.loadLibrary(Runtime.java:364)
04-10 05:04:48.990: E/JSONSTORE(6889): at java.lang.System.loadLibrary(System.java:526)
04-10 05:04:48.990: E/JSONSTORE(6889): at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:142)
04-10 05:04:48.990: E/JSONSTORE(6889): at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:136)
04-10 05:04:48.990: E/JSONSTORE(6889): at com.worklight.jsonstore.database.DatabaseManager.openDatabaseIfNecessary(DatabaseManager.java:179)
04-10 05:04:48.990: E/JSONSTORE(6889): at com.worklight.jsonstore.database.DatabaseManager.checkDatabaseAgainstSchema(DatabaseManager.java:98)
04-10 05:04:48.990: E/JSONSTORE(6889): at com.worklight.jsonstore.database.DatabaseSchema.isSchemaMismatched(DatabaseSchema.java:416)
04-10 05:04:48.990: E/JSONSTORE(6889): at com.worklight.jsonstore.api.WLJSONStore.provisionDatabase(WLJSONStore.java:149)
04-10 05:04:48.990: E/JSONSTORE(6889): at com.worklight.jsonstore.api.WLJSONStore.openCollections(WLJSONStore.java:345)
04-10 05:04:48.990: E/JSONSTORE(6889): at com.worklight.androidgap.jsonstore.dispatchers.ProvisionActionDispatcher.initializeCollection(ProvisionActionDispatcher.java:146)
04-10 05:04:48.990: E/JSONSTORE(6889): at com.worklight.androidgap.jsonstore.dispatchers.ProvisionActionDispatcher.databaseActionDispatch(ProvisionActionDispatcher.java:132)
04-10 05:04:48.990: E/JSONSTORE(6889): at com.worklight.androidgap.jsonstore.dispatchers.BaseDatabaseActionDispatcher.actionDispatch(BaseDatabaseActionDispatcher.java:36)
04-10 05:04:48.990: E/JSONSTORE(6889): at com.worklight.androidgap.jsonstore.dispatchers.BaseActionDispatcher.dispatch(BaseActionDispatcher.java:90)
04-10 05:04:48.990: E/JSONSTORE(6889): at com.worklight.androidgap.plugin.DispatchingPlugin$ActionDispatcherRunnable.run(DispatchingPlugin.java:79)
04-10 05:04:48.990: E/JSONSTORE(6889): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
04-10 05:04:48.990: E/JSONSTORE(6889): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
04-10 05:04:48.990: E/JSONSTORE(6889): at java.lang.Thread.run(Thread.java:841)
04-10 05:04:49.000: I/NONE(6889): PERSISTENT_STORE_FAILURE
04-10 05:04:49.000: E/wl.jsonstore(6889): {"src":"initCollection","err":-1,"msg":"PERSISTENT_STORE_FAILURE","col":"people","usr":"jsonstore","doc":{},"res":{}}
04-10 05:05:35.740: D/CordovaActivity(6889): Paused the application!
04-10 05:05:35.740: D/CordovaWebView(6889): Handle the pause
04-10 05:05:35.740: D/WLClient(6889): WLClient$ActivityListener.onActivityPaused in WLClient.java:1416 :: on activity paused com.JSONStoreAPI.JSONStoreAPI . activity count = 0
04-10 05:05:35.750: D/NONE(6889): Flush called
04-10 05:05:35.770: D/(6889): Surface destroy: ANDROID_NATIVE_WINDOW_MAGIC
04-10 05:05:35.780: D/WLClient(6889): WLClient$ActivityListener.onActivitySaveInstanceState in WLClient.java:1428 :: on activity save instance state com.JSONStoreAPI.JSONStoreAPI
04-10 05:05:35.780: D/WLClient(6889): WLClient$ActivityListener.onActivityStopped in WLClient.java:1440 :: on activity stopped com.JSONStoreAPI.JSONStoreAPI
04-10 05:05:35.790: W/IInputConnectionWrapper(6889): showStatusIcon on inactive InputConnection
JSONSTORE 代码是 MFP 开发者中心入门中的应用程序,因为我想使用干净的可信代码库(为了文章的简洁和长度限制,仅提供 main.js 的相关部分):
//Dependencies
var $ = jQuery,
_ = lodash;
//CONSTANTS
var PEOPLE_COLLECTION_NAME = 'people',
KEY_VALUE_COLLECTION_NAME = 'keyvalue',
INIT_FIRST_MSG = 'PERSISTENT_STORE_NOT_OPEN',
NAME_FIELD_EMPTY_MSG = 'Name field is empty',
AGE_FIELD_EMPTY_MSG = 'Age field is empty',
ID_FIELD_EMPTY_MSG = 'Id field is empty',
EMPTY_TABLE_MSG = 'No documents found',
DESTROY_MSG = 'Destroy finished succesfully',
INIT_MSG = 'Collection initialized',
ADD_MSG = 'Data added to the collection',
REPLACE_MSG = 'Document replaced succesfully, call find.',
REMOVE_MSG = 'Documents removed: ',
COUNT_MSG = 'Documents in the collection: ',
CLOSE_ALL_MSG = 'JSONStore closed',
REMOVE_COLLECTION_MSG = 'Removed all data in the collection',
LOAD_MSG = 'New documents loaded from adapter: ',
PUSH_MSG_FAILED = 'Could not push some docs, res: ',
PUSH_MSG = 'Push finished',
PASS_CHANGED_MSG = 'Password changed succesfully',
COUNT_QUERY_ERROR_MSG = 'FIND_BY_QUERY_EXPECTED_A_STRING',
COUNT_QUERY_MSG = "Documents in the collection with name = ";
...
...
...
...
...
//init
$('button#init').on('click', function () {
//Get references to the input fields DOM elements
var usernameField = $('input#init-username'),
passwordField = $('input#init-password');
//Get values from the input fields
var username = usernameField.val() || '',
password = passwordField.val() || '';
//Create the optional options object passed to init
var options = {};
//Check if a username was passed
if (username.length > 0) {
options.username = username;
}
//If if a password was passed
if (password.length > 0) {
options.password = password;
}
//JSONStore collections metadata
var collections = {};
//Define the 'people' collection and list the search fields
collections[PEOPLE_COLLECTION_NAME] = {
searchFields : {name: 'string', age: 'integer'},
//-- Start optional adapter metadata
adapter : {
name: 'People',
add: 'addPerson',
remove: 'removePerson',
replace: 'replacePerson',
load: {
procedure: 'getPeople',
params: [],
key: 'peopleList'
}
}
//-- End optional adapter metadata
};
//Define the 'keyvalue' collection and use additional search fields
collections[KEY_VALUE_COLLECTION_NAME] = {
searchFields : {},
additionalSearchFields : { key: 'string' }
};
//Initialize the people collection
WL.JSONStore.init(collections, options)
.then(function () {
_logMessage(INIT_MSG);
_callEnhanceToAddKeyValueMethods();
})
.fail(function (errorObject) {
_logError(errorObject.msg);
});
});
【问题讨论】:
-
您可以先在出错时提供 Android LogCat。
-
并添加您的 JSONStore 初始化实现。
-
令人讨厌的是,有问题的设备不允许像其他设备一样使用 USB 连接,以便查看 Studio 中的 logcat。 (至少我想不出来),因为它在设备上只有一个母 USB-A(普通 USB 端口)
-
更新:我已经能够将设备上的运行时间从 Davlik(旧)更改为 ART(新),现在抛出的错误是我正在调查的 OPERATION_FAILED_ON_SPECIFIC_DOCUMENT
-
有些应用程序允许远程 LogCat,研究一下。
标签: android ibm-mobilefirst jsonstore