dojo with phonegap for android

时间:2011-06-07 05:54:41

标签: android dojo cordova

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

感谢 Himabindu

2 个答案:

答案 0 :(得分:2)

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

要进行自定义构建,您需要src version of dojo

我扩展了目录“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" ]    
]    
}

你必须使用命令“./build.sh action = release profile = profiles / myBaseplus.profile.js -r”在shell中执行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    
                    }    
 );

答案 1 :(得分:0)

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

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

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