Android emulator 将Worklight(MFP)HTTP适配器与REST/JSON服务一起使用
我是Worklight的新手,一直在尝试运行以下示例: 当我在android emulator上运行应用程序并单击按钮时,出现以下错误:Android emulator 将Worklight(MFP)HTTP适配器与REST/JSON服务一起使用,android-emulator,ibm-mobilefirst,worklight-adapters,mobilefirst-adapters,Android Emulator,Ibm Mobilefirst,Worklight Adapters,Mobilefirst Adapters,我是Worklight的新手,一直在尝试运行以下示例: 当我在android emulator上运行应用程序并单击按钮时,出现以下错误: 警报(“mobGmapLatLngFailure”);在应用程序中 在logcat中 错误:02-09 04:05:21.924:D/NONE(1435):客户端注册失败,错误为:{“responseHeaders”:{},“status”:500,“responseText”:“invocationContext”:null}02-09 04:05:22.0
警报(“mobGmapLatLngFailure”)
;在应用程序中
在logcat中
错误:02-09 04:05:21.924:D/NONE(1435):客户端注册失败,错误为:{“responseHeaders”:{},“status”:500,“responseText”:“invocationContext”:null}02-09 04:05:22.074:E/NONE(1435):[/apps/services/api/AdapterApp/android/query]失败。状态:500,响应:未定义-
代码如下:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>AdaptersApp</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
<!--
<link rel="shortcut icon" href="images/favicon.png">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
-->
<link rel="stylesheet" href="css/main.css">
<script>window.$ = window.jQuery = WLJQ;</script>
<script>
function mobGmapLatLng(pAddress) {
var invocationData = {
adapter : 'myRESTAdapter',
procedure : 'getGmapLatLng',
parameters : [ pAddress ]
};
WL.Client.invokeProcedure(invocationData,{
onSuccess : mobGmapLatLngSuccess,
onFailure : mobGmapLatLngFailure,
});
}
function mobGmapLatLngSuccess(result) {
var httpStatusCode = result.status;
if (200 == httpStatusCode) {
var invocationResult = result.invocationResult;
var isSuccessful = invocationResult.isSuccessful;
if (true == isSuccessful) {
var lat = invocationResult.lat;
var lng = invocationResult.lng;
alert("Success: lat=" + lat + " lng=" + lng);
}
else {
alert("Error. isSuccessful=" + isSuccessful);
}
}
else {
alert("Error. httpStatusCode=" + httpStatusCode);
}
}
function mobGmapLatLngFailure(result){
alert("mobGmapLatLngFailure");
}
</script>
</head>
<body style="display: none;">
<!--application UI goes here-->
Hello MobileFirst
Hello Worklight with getGmapLatLng
<p>
<button onclick="mobGmapLatLng( '11501 Burnet Rd, Austin, TX, USA' )">Austin, TX, USA</button>
<p>
<button onclick="mobGmapLatLng( '4250 South Miami Boulevard, Durham, NC, USA' )">Durham, NC, USA</button>
<p>
<button onclick="mobGmapLatLng( '1681 Route des Dolines, 06560 Valbonne, France' )">Valbonne, France</button>
<p>
<button onclick="mobGmapLatLng( 'Shefayim 60990, Israel' )">Shefayim, Israel</button>
<p>
<button onclick="mobGmapLatLng( '399 Ke Yuan Lu, Shanghai, China' )">Shanghai, China</button>
<script src="js/initOptions.js"></script>
<script src="js/main.js"></script>
<script src="js/messages.js"></script>
</body>
myRESTAdapter.xml
<domain>maps.googleapis.com</domain>
<procedure name="getGmapLatLng"/>
02-18 03:28:45.750:I/dalvikvm(925):找不到从方法com.worklight.nativeandroid.common.WLUtils.getNoBackupFilesDir引用的方法android.content.Context.getNoBackupFilesDir
02-18 03:28:45.750:W/dalvikvm(925):VFY:无法解析虚拟方法147:Landroid/content/Context;。getnobackfilesdir()Ljava/io/File;
02-18 03:28:45.750:D/dalvikvm(925):VFY:在0x000b处替换操作码0x6e
02-18 03:28:47.130:W/WLClient(925):WLClient.createInstance在WLClient.java:225::您应该传递一个可从Activity类分配的上下文。WLClient实例可用于启动活动。
02-18 03:28:47.460:D/dalvikvm(925):释放311K的所有数据的GC_,12%的自由数据2950K/3344K,暂停113ms,总计127ms
02-18 03:28:49.080:D/wl(925):wl。在WL.java:60::WL构造函数中
02-18 03:28:49.120:D/wl.splashscreen(925):WLSplashScreen.show-in-WLSplashScreen.java:64::show-splashscreen
02-18 03:28:49.180:D/dalvikvm(925):释放278K的所有物质的GC_,13%的自由2969K/3404K,暂停27ms,总计28ms
02-18 03:28:49.180:I/dalvikvm堆(925):为576016字节分配将堆(frag案例)增长到3.522MB
02-18 03:28:49.230:D/dalvikvm(925):GC_FOR_将释放的JS模式分配为null
02-18 03:29:02.620:D/JsMessageQueue(925):将本机->JS模式设置为OnlineEventsBridgeMode
02-18 03:29:06.660:V/StatusBar(925):执行操作:_ready
02-18 03:29:06.660:W/CordovaPlugin(925):尝试为ID:StatusBar599974231发送第二次回调
02-18 03:29:06.660:W/CordovaPlugin(925):结果是:“无效操作”
02-18 03:29:06.750:D/CordovaNetworkManager(925):连接类型:3g
02-18 03:29:06.750:D/CordovaNetworkManager(925):连接额外信息:epc.tmobile.com
02-18 03:29:06.780:I/chromium(925):[信息:控制台(309)]“成功回调ID中的错误:APP59974232:错误:未知事件操作未定义”,来源:file:///android_asset/www/default/worklight/cordova.js (309)
02-18 03:29:06.860:I/chromium(925):[信息:控制台(311)]“未捕获错误:未知事件操作未定义”,来源:file:///android_asset/www/default/worklight/cordova.js (311)
02-18 03:29:07.430:E/NONE(925):未捕获异常:未捕获错误:未知事件操作未在处定义(编译代码):311
02-18 03:29:07.450:D/NONE(925):已调度ondeviceready事件
02-18 03:29:07.570:W/PluginManager(925):线程警告:对Globalization.getLocaleName的exec()调用阻止了主线程154ms。插件应使用CordovaInterface.getThreadPool()。
02-18 03:29:07.690:D/NONE(925):wlclient初始化已启动
02-18 03:29:07.750:D/NONE(925):读取cookies:null
02-18 03:29:07.890:D/NONE(925):CookieMgr读取cookies:{}
02-18 03:29:08.010:W/NONE(925):请注意,如果您的应用程序针对Android 3.0(API级别11)或更高版本,则WL.options菜单可能无效,具体取决于设备。
02-18 03:29:08.100:D/dalvikvm(925):释放531K的所有数据的GC_,13%的自由数据为4376K/4984K,暂停32ms,总计33ms
02-18 03:29:08.110:D/NONE(925):添加设备头设备成功回调
02-18 03:29:08.160:D/com.worklight.androidgap.plugin.WLNativeXHRPlugin(925):WLNativeXHRPlugin.execute-in-WLNativeXHRPlugin.java:52::execute
02-18 03:29:08.180:D/com.worklight.androidgap.plugin.WLNativeXHRPlugin(925):WLNativeXHRPlugin.doAddGlobalHeader在WLNativeXHRPlugin.java:100::doAddGlobalHeader中
02-18 03:29:08.240:D/NONE(925):连接启动完成单元
02-18 03:29:08.330:D/NONE(925):在:initOptions.onSuccess之前
02-18 03:29:08.460:D/wl.splashscreen(925):WLSplashScreen.hide-in-WLSplashScreen.java:71::Hiding-splashscreen
02-18 03:29:08.480:I/dalvikvm(925):找不到方法com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable,从方法com.worklight.wlclient.push.common.GCMClientFactory.useGooglePlayServices引用
02-18 03:29:08.540:W/dalvikvm(925):VFY:无法解析静态方法651:Lcom/google/android/gms/common/GooglePlayServicesUtil;。iGoogle PlayServicesAvailable(Landroid/content/Context;)I
02-18 03:29:08.540:D/dalvikvm(925):VFY:在0x0006处替换操作码0x71
02-18 03:29:08.600:D/GCMClientFactory(925):GCMClientFactory.useGooglePlayServices在GCMClientFactory.java:42::Google Play Services未使用,因为找不到播放服务库。因此,使用默认的GCM助手实现。
02-18 03:29:08.610:W/PluginManager(925):线程警告:对Push.notifyInitComplete的exec()调用已阻止主线程17毫秒。插件应使用CordovaInterface.getThreadPool()。
02-18 03:29:08.690:D/GCMClientFactory(925):GCMClientFactory.getInstance位于GCMClientFactory.java:28::使用gcmHelpPerClient
02-18 03:29:08.760:D/NONE(925):之后:initOptions.onSuccess
02-18 03:29:08.770:D/NONE(925):添加了onPause和onResume事件处理程序
02-18 03:29:08.790:D/NONE(925):wlclient初始化成功
02-17 03:32:33.982:W/PluginManager(925):线程警告:对LoggerPlugin.log的exec()调用将主线程阻塞85毫秒。插件应使用CordovaInterface.getThreadPool()。
02-17 03:32:34.072:I/编舞(925):跳过37帧!应用程序可能在其主线程上做了太多工作。
02-17 03:32:34.362:D/无(925):建立客户关系
02-17 03:32:34.382:W/PluginManager(925):线程警告:对UserAuth.init的exec()调用将主线程阻塞了28毫秒。插件应使用CordovaInterface.getThreadPool()。
02-17 03:32:34.462:I/编舞(925):跳过
<domain>maps.googleapis.com</domain>
<procedure name="getGmapLatLng"/>
02-18 03:28:44.460: D/dalvikvm(925): Not late-enabling CheckJNI (already on)