dojo with phonegap for android



我想在phonegap应用程序中使用dojo。我尝试在android中测试dojo的应用程序。但他们并没有在模拟器中显示任何内容。有人能帮助我如何在phonegap应用程序中使用dojo吗。

谢谢Himabindu

Android在动态加载方面存在一些问题。这意味着您必须对dojo 1.7.1进行自定义构建。

要进行自定义构建,您需要dojo的src版本。

我扩展了目录"dojo/util/builsscripts/profiles/"中的概要文件"baseplus.profile.js",如下所示:

dependencies = {
    selectorEngine: "acme",
    layers: [
             {
// This is a specially named layer, literally 'dojo.js'
// adding dependencies to this layer will include the modules    
// in addition to the standard dojo.js base APIs.    
             name: "dojo.js",    
             dependencies: [    
                 "dijit._Widget",    
                 "dijit._Templated",    
                 "dojo.fx",    
                 "dojo.NodeList-fx",    
//this wasn't included in the standard build but necessary 
                 "dojo._firebug.firebug",    
 //my used dojo requirements
                 "dojox.mobile.parser",    
                 "dojox.mobile",     
                 "dojox.mobile.Button",    
                 "dojox.mobile.SwapView",    
                 "dojox.mobile.ScrollableView",    
                 "dojox.mobile.TabBar",     
                 "dojox.mobile.SpinWheelTimePicker",     
                 "dojox.mobile.compat"    
            ]     
       }    
], 
prefixes: [   
       ["dijit", "../dijit" ],    
       ["dojox", "../dojox" ]    
]    
}

您必须在shell中使用命令"./build.sh action=releaseprofile=profiles/myBaseplus.profile.js-r"执行build.sh(Unix/OSx)或build.bat(Windows)

成功构建后,您可以在"dojo/release/djojo/dojo.js"中找到dojo.js文件。

你只需要这个文件。

无论如何,您还需要在html文件中使用以下require语句:

require([    
                     "dojox/mobile/parser",      // (Optional) This mobile app uses declarative programming with fast mobile parser    
                     "dojox/mobile",             // (Required) This is a mobile app.    
                     "dojox/mobile/Button",    
                     "dojox/mobile/SwapView",    
                     "dojox/mobile/ScrollableView",    
                     "dojox/mobile/TabBar",    
                     "dojox/mobile/SpinWheelTimePicker",    
                     "dojox/mobile/compat"       // (Optional) This mobile app supports running on desktop browsers    
                     ],
                     function(parser, mobile, compat){    
                    //Optional module aliases that can then be referenced inside callback block    
                    }    
 );

尝试将tweetview.html重命名为index.html.

PhoneGap入口点文件名需要与本机源的文件名相匹配。在Android上,连接来自src/{com.package}/{activityname}.java.

super.loadUrl("file:///android_asset/www/index.html");

最新更新