IBM Worklight 6.0 - 无法在 avd 上使用适用于 android 环境的 dojo 工具包运行示例混合 Worklight 应用程序?

Posted

技术标签:

【中文标题】IBM Worklight 6.0 - 无法在 avd 上使用适用于 android 环境的 dojo 工具包运行示例混合 Worklight 应用程序?【英文标题】:IBM Worklight 6.0 - Unable to run sample hybrid worklight app using dojo toolkit for android environment on avd? 【发布时间】:2013-07-09 08:53:48 【问题描述】:

我使用 worklight 6.0dojo toolkit 1.9android environment2.2 开发了一个示例混合应用程序。 当我在模拟器上测试这个应用程序时,它工作正常。但是当我在 AVD 或实际设备上尝试它时,它运行但只显示一个空白屏幕。 无法理解如何使其在实际设备上正常工作?

当我尝试在 AVD 上运行时,我注意到以下错误列表:

07-08 19:51:22.462: I/dalvikvm(664): Could not find method org.apache.cordova.CordovaWebView.setOverScrollMode, referenced from method org.apache.cordova.DroidGap.init
07-08 19:51:22.462: W/dalvikvm(664): VFY: unable to resolve virtual method 12024: Lorg/apache/cordova/CordovaWebView;.setOverScrollMode (I)V
07-08 19:51:22.462: D/dalvikvm(664): VFY: replacing opcode 0x6e at 0x0043
07-08 19:51:22.502: I/CordovaLog(664): Changing log level to DEBUG(3)
07-08 19:51:22.502: I/CordovaLog(664): Found preference for exit-on-suspend=false
07-08 19:51:22.502: D/CordovaLog(664): Found preference for exit-on-suspend=false
07-08 19:51:22.502: D/DroidGap(664): DroidGap.onCreate()
07-08 19:51:22.552: I/dalvikvm(664): Could not find method android.webkit.WebView.<init>, referenced from method org.apache.cordova.CordovaWebView.<init>
07-08 19:51:22.552: W/dalvikvm(664): VFY: unable to resolve direct method 536: Landroid/webkit/WebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
07-08 19:51:22.552: D/dalvikvm(664): VFY: replacing opcode 0x70 at 0x0001
07-08 19:51:22.552: D/dalvikvm(664): VFY: dead code 0x0004-0046 in Lorg/apache/cordova/CordovaWebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
07-08 19:51:22.852: D/JsMessageQueue(664): Set native->JS mode to 2
07-08 19:51:22.852: I/CordovaWebView(664): Disabled addjavascriptInterface() bridge since Android version is old.
07-08 19:51:22.852: E/dalvikvm(664): Could not find class 'android.webkit.WebResourceResponse', referenced from method org.apache.cordova.CordovaWebViewClient.getWhitelistResponse
07-08 19:51:22.852: W/dalvikvm(664): VFY: unable to resolve new-instance 176 (Landroid/webkit/WebResourceResponse;) in Lorg/apache/cordova/CordovaWebViewClient;
07-08 19:51:22.852: D/dalvikvm(664): VFY: replacing opcode 0x22 at 0x000b
07-08 19:51:22.852: D/dalvikvm(664): VFY: dead code 0x000d-0014 in Lorg/apache/cordova/CordovaWebViewClient;.getWhitelistResponse ()Landroid/webkit/WebResourceResponse;
07-08 19:51:22.872: W/dalvikvm(664): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
07-08 19:51:22.892: W/dalvikvm(664): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
07-08 19:51:22.892: W/dalvikvm(664): VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
07-08 19:51:23.012: D/DroidGap(664): DroidGap.init()
07-08 19:51:23.122: I/UICAndroid(664): LoggingLevel=3, AddCookieDomain=false, PostMessageTimeout=60000, CookiePath=/, CookieParam=, KillSwitchTimeInterval=180, BufferPercent=20, HasToPersistLocalCache=true , MessageTypeHeader=WorklightHit, CookieDomain=, WhiteListParam=id, LibraryVersion=8.8.1.0, MaskIdList=com.tealeaf.sp:id/EditText*,com.tealeaf.sp:id/login.password, PostMessageLevelWiFi=3, UseRandomSample=false, KillSwitchMaxNumberOfTries=3, SensitiveCapitalCaseAlphabet=X, FilterMessageTypes=true, PostMessageTimeIntervals=30, SensitiveSmallCaseAlphabet=x, CompressPostMessage=true, PostMessageMaxBytesSize=20000, SensitiveSymbol=#, PostMessageLevelCellular=3, MessageTypes=4,5,6, PostMessageSocketTimeout=60000, CookieUrl=, UseWhiteList=true, KillSwitchUrl=, KillSwitchEnabled=false, MessageVersion=2.1.0.0, HasMasking=true, TimeIntervalBetweenSnapshots=60, PostMessageUrl=@USE_WORKLIGHT_DEFAULT@, CachedFileMaxBytesSize=512000, BufferLimit=100, AddCookiePath=false, SensitiveNumber=9, CachingLevel=3, ManualPostEnabled=true, HasCustomMask=true, DisplayLogging=true, MaxStringsLength=300, AddMessageTypeHeader=true, RandomSampleParam=, DoPostOnIntervals=false
07-08 19:51:23.232: D/dalvikvm(664): GC_FOR_MALLOC freed 3250 objects / 238920 bytes in 63ms
07-08 19:51:23.262: I/UICAndroid(664): Screen height:800  Screen width420
07-08 19:51:23.342: D/DroidGap(664): Resuming the App
07-08 19:51:23.402: I/UICAndroid(664): Network changed
07-08 19:51:23.432: D/SoftKeyboardDetect(664): Ignore this event
07-08 19:51:23.502: D/WLDroidGap(664): New installation/upgrade detected, copying resources and saving new checksum
07-08 19:51:23.542: D/SoftKeyboardDetect(664): Ignore this event
07-08 19:51:23.732: I/UICAndroid(664): Did Client State change?: true
07-08 19:51:26.842: D/dalvikvm(664): GC_FOR_MALLOC freed 5447 objects / 429112 bytes in 71ms
07-08 19:51:31.494: D/WLDroidGap(664): Started copying files to local storage...
07-08 19:51:32.402: D/dalvikvm(664): GC_FOR_MALLOC freed 6653 objects / 552224 bytes in 58ms
07-08 19:51:34.072: D/dalvikvm(664): GC_FOR_MALLOC freed 1876 objects / 203720 bytes in 50ms
07-08 19:51:35.341: D/dalvikvm(664): GC_FOR_MALLOC freed 1528 objects / 494368 bytes in 71ms
07-08 19:51:36.441: D/dalvikvm(664): GC_FOR_MALLOC freed 2070 objects / 515744 bytes in 61ms
07-08 19:51:38.511: D/dalvikvm(664): GC_FOR_MALLOC freed 2270 objects / 520176 bytes in 64ms
07-08 19:51:40.661: D/dalvikvm(664): GC_FOR_MALLOC freed 2191 objects / 523952 bytes in 52ms
07-08 19:51:41.061: D/dalvikvm(664): GC_FOR_MALLOC freed 1969 objects / 525120 bytes in 65ms
07-08 19:51:42.782: D/dalvikvm(664): GC_FOR_MALLOC freed 2305 objects / 526720 bytes in 52ms
07-08 19:51:46.472: D/dalvikvm(664): GC_FOR_MALLOC freed 2529 objects / 529368 bytes in 52ms
07-08 19:51:47.993: D/WLDroidGap(664): Finished copying files to local storage...
07-08 19:51:48.012: D/WLDroidGap(664): no need to check web resource integrity
07-08 19:51:48.102: D/CordovaWebView(664): >>> loadUrl(file:///data/data/com.AccordFintech/files/www/skinLoader.html)
07-08 19:51:48.102: D/PluginManager(664): init()
07-08 19:51:48.112: D/CordovaWebView(664): >>> loadUrlNow()
07-08 19:51:48.592: D/DroidGap(664): onMessage(onPageStarted,file:///data/data/com.AccordFintech/files/www/skinLoader.html)
07-08 19:51:48.792: D/dalvikvm(664): GC_FOR_MALLOC freed 2184 objects / 422000 bytes in 81ms
07-08 19:51:49.592: D/Cordova(664): onPageFinished(file:///data/data/com.AccordFintech/files/www/skinLoader.html)
07-08 19:51:49.592: D/Cordova(664): Trying to fire onNativeReady
07-08 19:51:49.592: D/DroidGap(664): onMessage(onNativeReady,null)
07-08 19:51:49.592: D/DroidGap(664): onMessage(onPageFinished,file:///data/data/com.AccordFintech/files/www/skinLoader.html)
07-08 19:51:50.232: D/CordovaLog(664): Falling back on PROMPT mode since _cordovaNative is missing. Expected for Android 3.2 and lower only.
07-08 19:51:50.232: I/Web Console(664): Falling back on PROMPT mode since _cordovaNative is missing. Expected for Android 3.2 and lower only. at file:///data/data/com.AccordFintech/files/www/default/wlclient/js/cordova.js:908
07-08 19:51:50.322: D/CordovaNetworkManager(664): Connection Type: 3g
07-08 19:51:50.322: D/CordovaNetworkManager(664): Connection Type: 3g
07-08 19:51:50.322: D/DroidGap(664): onMessage(networkconnection,3g)
07-08 19:51:50.352: D/DroidGap(664): onMessage(spinner,stop)
07-08 19:51:50.492: D/CordovaWebView(664): >>> loadUrl(file:///data/data/com.AccordFintech/files/www/default/AccordFintech.html)
07-08 19:51:50.492: D/PluginManager(664): init()
07-08 19:51:50.512: D/CordovaWebView(664): >>> loadUrlNow()
07-08 19:51:50.532: D/DroidGap(664): onMessage(onPageStarted,file:///data/data/com.AccordFintech/files/www/default/AccordFintech.html)
07-08 19:51:50.733: D/dalvikvm(664): GC_FOR_MALLOC freed 2859 objects / 241376 bytes in 121ms
07-08 19:51:50.912: D/dalvikvm(664): GC_FOR_MALLOC freed 1560 objects / 135728 bytes in 54ms
07-08 19:51:51.622: D/DroidGap(664): onMessage(spinner,stop)
07-08 19:51:53.622: D/dalvikvm(664): GC_FOR_MALLOC freed 1225 objects / 370792 bytes in 153ms
07-08 19:51:56.991: D/Cordova(664): onPageFinished(file:///data/data/com.AccordFintech/files/www/default/AccordFintech.html)
07-08 19:51:56.991: D/Cordova(664): Trying to fire onNativeReady
07-08 19:51:56.991: D/DroidGap(664): onMessage(onNativeReady,null)
07-08 19:51:56.991: D/DroidGap(664): onMessage(onPageFinished,file:///data/data/com.AccordFintech/files/www/default/AccordFintech.html)
07-08 19:51:57.641: D/CordovaLog(664): Falling back on PROMPT mode since _cordovaNative is missing. Expected for Android 3.2 and lower only.
07-08 19:51:57.641: I/Web Console(664): Falling back on PROMPT mode since _cordovaNative is missing. Expected for Android 3.2 and lower only. at file:///data/data/com.AccordFintech/files/www/default/wlclient/js/cordova.js:908
07-08 19:51:57.702: D/CordovaNetworkManager(664): Connection Type: 3g
07-08 19:51:57.721: D/CordovaNetworkManager(664): Connection Type: 3g
07-08 19:51:57.721: D/DroidGap(664): onMessage(networkconnection,3g)
07-08 19:51:57.741: D/DroidGap(664): onMessage(spinner,stop)
07-08 19:51:57.911: I/dalvikvm(664): Could not find method java.util.Calendar.getDisplayNames, referenced from method org.apache.cordova.Globalization.getDateNames
07-08 19:51:57.911: W/dalvikvm(664): VFY: unable to resolve virtual method 10795: Ljava/util/Calendar;.getDisplayNames (IILjava/util/Locale;)Ljava/util/Map;
07-08 19:51:57.911: D/dalvikvm(664): VFY: replacing opcode 0x74 at 0x009d
07-08 19:51:57.911: I/dalvikvm(664): Could not find method java.util.Calendar.getDisplayNames, referenced from method org.apache.cordova.Globalization.getDateNames
07-08 19:51:57.911: W/dalvikvm(664): VFY: unable to resolve virtual method 10795: Ljava/util/Calendar;.getDisplayNames (IILjava/util/Locale;)Ljava/util/Map;
07-08 19:51:57.911: D/dalvikvm(664): VFY: replacing opcode 0x74 at 0x00d0
07-08 19:51:57.911: I/dalvikvm(664): Could not find method java.util.Calendar.getDisplayNames, referenced from method org.apache.cordova.Globalization.getDateNames
07-08 19:51:57.911: W/dalvikvm(664): VFY: unable to resolve virtual method 10795: Ljava/util/Calendar;.getDisplayNames (IILjava/util/Locale;)Ljava/util/Map;
07-08 19:51:57.922: D/dalvikvm(664): VFY: replacing opcode 0x74 at 0x00e3
07-08 19:51:57.922: I/dalvikvm(664): Could not find method java.util.Calendar.getDisplayNames, referenced from method org.apache.cordova.Globalization.getDateNames
07-08 19:51:57.922: W/dalvikvm(664): VFY: unable to resolve virtual method 10795: Ljava/util/Calendar;.getDisplayNames (IILjava/util/Locale;)Ljava/util/Map;
07-08 19:51:57.922: D/dalvikvm(664): VFY: replacing opcode 0x74 at 0x00f2
07-08 19:51:57.922: D/dalvikvm(664): VFY: dead code 0x00a0-00b8 in Lorg/apache/cordova/Globalization;.getDateNames (Lorg/json/JSONArray;)Lorg/json/JSONObject;
07-08 19:51:57.922: D/dalvikvm(664): VFY: dead code 0x00d3-00d4 in Lorg/apache/cordova/Globalization;.getDateNames (Lorg/json/JSONArray;)Lorg/json/JSONObject;
07-08 19:51:57.922: D/dalvikvm(664): VFY: dead code 0x00e6-00e7 in Lorg/apache/cordova/Globalization;.getDateNames (Lorg/json/JSONArray;)Lorg/json/JSONObject;
07-08 19:51:57.922: D/dalvikvm(664): VFY: dead code 0x00f5-0118 in Lorg/apache/cordova/Globalization;.getDateNames (Lorg/json/JSONArray;)Lorg/json/JSONObject;
07-08 19:51:58.061: D/AccordFintech(664): wlclient init started
07-08 19:51:58.081: D/AccordFintech(664): Read cookies: null
07-08 19:51:58.091: D/AccordFintech(664): CookieMgr read cookies: 
07-08 19:51:58.261: D/dalvikvm(664): GC_FOR_MALLOC freed 5659 objects / 415552 bytes in 64ms
07-08 19:51:58.541: D/AccordFintech(664): before: app init onSuccess
07-08 19:51:58.621: D/AccordFintech(664): after: app init onSuccess
07-08 19:51:58.621: D/AccordFintech(664): added onPause event handler 
07-08 19:51:58.631: D/AccordFintech(664): wlclient init success
07-08 19:52:03.632: D/CordovaLog(664): Error: scriptError
07-08 19:52:03.632: E/Web Console(664): Error: scriptError at file:///data/data/com.AccordFintech/files/www/default/dojo/dojo.js:21
07-08 19:52:03.632: D/CordovaLog(664): Error: scriptError
07-08 19:52:03.642: E/Web Console(664): Error: scriptError at file:///data/data/com.AccordFintech/files/www/default/dojo/dojo.js:21

生成的 Accordfintech.html:

<!DOCTYPE HTML><html>
    <head>
        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta charset="UTF-8">
        <title>AccordFintech</title>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <meta content="yes" name="apple-mobile-web-app-capable">
        <link href="wlclient/css/wlclient.css" rel="stylesheet">
        <link href="wlclient/css/wlgap.android.css" rel="stylesheet">
        <link href="images/favicon.png" rel="shortcut icon">
        <link href="images/apple-touch-icon.png" rel="apple-touch-icon">
        <link href="css/AccordFintech.css" rel="stylesheet">
        <script>
        // Define WL namespace.
        var WL = WL ? WL : ;
        /**
         * WLClient configuration variables.
         * Values are injected by the deployer that packs the gadget.
         */
        WL.StaticAppProps = 
   "APP_DISPLAY_NAME": "AccordFintech",
   "APP_SERVICES_URL": "\/apps\/services\/",
   "APP_VERSION": "1.0",
   "ENVIRONMENT": "android",
   "LOGIN_DISPLAY_TYPE": "embedded",
   "WORKLIGHT_PLATFORM_VERSION": "6.0.0",
   "WORKLIGHT_ROOT_URL": "\/apps\/services\/api\/AccordFintech\/android\/"
;</script>
        <script src="wlclient/js/cordova.js"></script>
        <script src="common/js/wljq.js"></script>
        <script src="common/js/wl_.min.js"></script>
        <script src="common/js/sjcl.min.js"></script>
        <script src="wlclient/js/analytics/Tealeaf.min.js"></script>
        <script src="common/js/stacktrace.min.js"></script>
        <script src="common/js/base.js"></script>
        <script src="wlclient/js/messages.js"></script>
        <script src="common/js/wlcommon.js"></script>
        <script src="wlclient/js/diagnosticDialog.js"></script>
        <script src="wlclient/js/deviceAuthentication.js"></script>
        <script src="wlclient/js/window.js"></script>
        <script src="wlclient/js/worklight.js"></script>
        <script src="wlclient/js/wlclient.js"></script>
        <script src="wlclient/js/wlfragments.js"></script>
        <script src="wlclient/js/encryptedcache.js"></script>
        <script src="wlclient/js/analytics/analytics.js"></script>
        <script src="wlclient/js/checksum.js"></script>
        <script src="wlclient/js/deviceSensors/triggers.js"></script>
        <script src="wlclient/js/deviceSensors/acquisition.js"></script>
        <script src="wlclient/js/deviceSensors/geo.js"></script>
        <script src="wlclient/js/deviceSensors/wifi.js"></script>
        <script src="wlclient/js/events/eventTransmitter.js"></script>
        <script src="wlclient/js/deviceSensors/bind.js"></script>
        <script src="wlclient/js/deviceSensors/geoUtilities.js"></script>
        <script src="wlclient/js/challengeHandlers/antiXSRFChallengeHandler.js"></script>
        <script src="wlclient/js/challengeHandlers/authenticityChallengeHandler.js"></script>
        <script src="wlclient/js/challengeHandlers/deviceAuthAutoProvisioningChallengeHandler.js"></script>
        <script src="wlclient/js/challengeHandlers/deviceAuthNoProvisioningChallengeHandler.js"></script>
        <script src="wlclient/js/challengeHandlers/remoteDisableChallengeHandler.js"></script>
        <script src="wlclient/js/deviceSensors/ExtendedGeolocation.js"></script>
        <script src="wlclient/js/features_stubs/jsonstore_stub.js"></script>
        <script src="wlclient/js/wlgap.android.js"></script>
        <script>window.$ = window.jQuery = WLJQ;</script>
            <script src="dojox/mobile/deviceTheme.js" type="text/javascript"></script>
            <script type="text/javascript">
if (typeof dojoConfig == "undefined") 
    var dojoConfig = ;

(function()
    var modules =  dojo: name: "dojo", location: "http://localhost:53514/dojoLib/Acc/AccordFintech/android/dojo", dijit: name: "dijit", location: "http://localhost:53514/dojoLib/Acc/AccordFintech/android/dijit", dojox: name: "dojox", location: "http://localhost:53514/dojoLib/Acc/AccordFintech/android/dojox";
    if (!dojoConfig.packages) 
        dojoConfig.packages = [];
    
    else 
        for (var i = 0; i < dojoConfig.packages.length; i++) 
            delete modules[dojoConfig.packages[i].name];
        
    
    if (dojoConfig.packages.push) 
        for (var module in modules) 
            dojoConfig.packages.push(modules[module]);
        
    
)();
</script><script data-dojo-config="isDebug: false, async: true, parseOnLoad: true, mblHideAddressBar: false" src="dojo/dojo.js" type="text/javascript"></script>
    </head>
    <body id="content" style="display: none;">
        <div data-dojo-props="label:'Accord Fintech'" data-dojo-type="dojox.mobile.Heading"></div>
        <div data-dojo-props="selected:true" data-dojo-type="dojox.mobile.ScrollableView" id="view0">
            <div data-dojo-type="dojox.mobile.RoundRectList">
                <div data-dojo-props="label:'About Us',moveTo:'Aboutusview',transition:'flip',dir:'-1'" data-dojo-type="dojox.mobile.ListItem"></div>
                <div data-dojo-props="label:'Database',moveTo:'Databaseview',transition:'flip',dir:'-1'" data-dojo-type="dojox.mobile.ListItem"></div>
                <div data-dojo-props="label:'Software',moveTo:'Softwareview',transition:'flip',dir:'-1'" data-dojo-type="dojox.mobile.ListItem"></div>
                <div data-dojo-props="label:'Research',moveTo:'Researchview',transition:'flip',dir:'-1'" data-dojo-type="dojox.mobile.ListItem"></div>
                <div data-dojo-props="label:'Products',moveTo:'productsview',transition:'flip',dir:'-1'" data-dojo-type="dojox.mobile.ListItem"></div>
                <div data-dojo-props="label:'Contact Us',moveTo:'Contactusview',transition:'flip',dir:'-1'" data-dojo-type="dojox.mobile.ListItem"></div>
            </div>
        <!--application UI goes here-->
        </div>
        <div data-dojo-type="dojox.mobile.View" id="Aboutusview"></div>
        <div data-dojo-type="dojox.mobile.View" id="Softwareview"></div>
        <div data-dojo-type="dojox.mobile.View" id="Databaseview"></div>
        <div data-dojo-type="dojox.mobile.View" id="Researchview"></div>
        <div data-dojo-type="dojox.mobile.View" id="productsview"></div>
        <div data-dojo-type="dojox.mobile.View" id="Contactusview"></div>
        <script src="js/initOptions.js"></script>
            <script src="js/AccordFintech.js"></script>
            <script src="js/messages.js"></script>
    </body>
</html>

.js 文件:

function wlCommonInit()
    require([ "layers/core-web-layer", "layers/mobile-ui-layer" ], dojoInit);
    
function dojoInit() 
    require([ "dojo/ready", "dojo/parser", "dojox/mobile", "dojo/dom", "dijit/registry", "dojox/mobile/ScrollableView", "dojox/mobile/View", "dojox/mobile/Heading", "dojox/mobile/RoundRectList", "dojox/mobile/ListItem" ], function(ready) 
        ready(function() 
        );
    );

【问题讨论】:

您在开发控制台中遇到的错误不是错误并且是不相关的。您可以放心地忽略它们。 任何帮助将不胜感激。 @IdanAdar 如何在设备上测试它你能告诉我步骤吗 【参考方案1】:

让我们稍微备份一下。 在 nsand 关于控制台视图的帖子中,他试图确定您的应用程序是否正在使用 6.0 中引入的新 Dojo 库服务器。简而言之,对于 6.0,您的应用程序中只有 Dojo Mobile Layers。它需要的任何其他资源,例如翻译、dijit 小部件正在从服务器提供。您可以在 6.0 信息中心阅读:http://pic.dhe.ibm.com/infocenter/wrklight/v6r0m0/index.jsp?topic=%2Fcom.ibm.rad.worklight.doc%2Ftopics%2Fcdojolibprjsetupwl.html

如果您按照 nsand 的步骤取消选中提供库资源,这将关闭您的应用程序对 Dojo 库/服务器的访问。它的所有 Dojo 需求都必须由 Dojo Mobile 层处理,否则您必须将所需资源复制到项目中。

所以 第 1 步:验证您的应用程序在 Mobile Browser Simulator 中工作,并选中提供库资源。如果控制台日志显示从服务器提供的资源,则必须先将这些资源复制到您的应用程序,然后再部署到 AVD 或设备

第 2 步:在您认为项目中拥有所有 Dojo/资源后,取消选中提供库资源并在 MBS 中再次对其进行测试。如果它在 MBS 中失败,则说明库/服务器中的应用程序中缺少某些内容。您可以检查提供图书馆资源并重新测试以查看它是否向您显示了那是什么。并非所有资源都显示出来,例如如果缺少 CSS 文件。

如果这有助于您找到问题,请告诉我们。如果您取消选中提供库资源并且它在 MBS 中运行良好但在设备上失败,那么我们需要寻找其他地方。

(注意:有一个缺陷会阻止您将 Dojo Library/Server 与 AVD 或在您的设备上使用。这将很快得到修复。不过,使用 Dojo Library/Server 是一个开发时间概念。之前当您进入生产环境时,您的应用需要访问所有必要的资源,而无需从 Studio 中的 Dojo 库/服务器提供这些资源)。

【讨论】:

【参考方案2】:

除了包含*_ROOT.js 文件之外,您可能还需要从应用程序中删除开发配置。为此,请打开控制台视图(Window > Show View > Other... > Console)。在 Console 视图中,单击 Open Console 按钮并从列表中选择 Dojo Library Requests。在 Dojo Library Requests 控制台中,单击 View Menu(工具栏中的三角形),然后取消选中 Provide Library Resources。在此之后,构建应用程序环境并将其部署到您的模拟器或设备。

【讨论】:

感谢您的回复。但是在完成所有程序之后,当我尝试在 avd 上运行应用程序时,它仍然无法正常工作,并且它突然停止并且没有抛出任何错误消息,它关闭了。不明白是什么问题? 我是否必须进行某些更改才能在设备或 AVD 上运行它?因为它在模拟器中可以正常工作,但在 AVD 或设备方面它就无法正常工作。 在生成的android项目下,如果打开assets/www/default/Accordfintech.html,搜索dojo.js的script标签。在此之前是否有以if (typeof dojoConfig == "undefined") 开头的脚本块? 不,dojo.js 在提到的块之前没有任何脚本标签。这有什么问题吗? 当我将我的项目文件夹与 ibm 站点上提供的示例进行比较时,我注意到了一件事情,我的示例应用程序中没有 dojo-build 文件夹。这有什么问题吗?如果是,那么我该如何解决这个问题?请帮我解决这个问题。【参考方案3】:

从 Eclipse 中的 DojoLib 项目中,复制文件:

DojoLib\dojo\dojo\nls\core-web-layer_ROOT.js DojoLib\Dojo\dojo\nls\mobile-ui-layer_ROOT.js

将您的 Worklight 项目中的文件粘贴到 www\dojo\nls 下。

再次尝试运行该项目。 可能需要进行其他更改,但让我们先看看上述是否有效。

【讨论】:

感谢您的回复。但这两个文件已经在那里了。 是否有任何文件说明需要做些什么才能使任何启用了 dojo 工具包的应用程序在设备上工作? worklight 6.0 与android 2.2 是否存在不兼容问题? 请查看您生成的 HTML 文件,向我展示它的内容(使用此信息编辑您的问题)。 我已经用生成的 HTML 文件的内容编辑了我的问题。

以上是关于IBM Worklight 6.0 - 无法在 avd 上使用适用于 android 环境的 dojo 工具包运行示例混合 Worklight 应用程序?的主要内容,如果未能解决你的问题,请参考以下文章

IBM Worklight 6.0 - 无法更改默认 WL.BusyIndi​​cator 文本

IBM Worklight 6.0 - 无法将应用程序发布到 Application Center?

IBM Worklight 6.0 - 使用 Web 服务的混合应用程序无法在实际设备上运行?

IBM Worklight 6.0 - 适配器身份验证失败:“服务器无法处理来自应用程序的请求”

IBM Worklight 6.0 - WL.TabBar.addItem 标题参数无法正确使用“null”作为值

IBM Worklight 6.0 - BlackBerry 10 中的 window.open() 失败