Sencha 2.1.0应用程序在模拟器上成功运行,但未在Android设备上启动

时间:2013-01-09 08:10:35

标签: android android-emulator sencha-touch sencha-touch-2

我使用Sencha Touch 2.1.0开发了一款应用。我的应用程序在模拟器上成功运行,但是当我尝试在任何设备上启动时(我尝试了四种不同的设备),默认的Sencha启动画面不会消失,应用程序也无法启动。我从log-cat中发现的错误是:

  

12-27 18:39:21.580:E / Web Console(23413):未捕获错误:[Ext.Loader]无法加载'file:///android_asset/touch/src/event/Dispatcher.js',请验证文件是否存在于file:///android_asset/touch/sencha-touch.js:8321
  12-27 18:39:21.580:E / Web Console(23413):未捕获错误:[Ext.Loader]加载'file:///android_asset/touch/src/event/publisher/Dom.js'失败,请验证该文件存在于file:///android_asset/touch/sencha-touch.js:8321

2 个答案:

答案 0 :(得分:0)

看起来您正在使用应用程序的开发版本,它会在每个类中单独加载。我总是使用sencha的构建工具,并在进入设备之前构建“测试”或“生产”。如果从项目根调用,则构建测试的调用是:

// this figures out all your project dependencies
sencha app resolve http://localhost/ref/to/your/project/index.html dependencies.json
// this will build your project for testing, which does not remove white 
// space or comments, and does not generate cache.manifest files for HTML5 caching 
sencha app build -e testing

构建目标目录在app.json文件中配置,并且有一些类似于:

的行
"buildPaths": {
    "testing": "../builds/testing",
    "production": "../builds/production",
    "package": "../builds/package",
    "native": "../builds/native"
},

我的开发流程是在浏览器中构建,然后在我需要在设备上进行测试时构建“测试”。这是我的build.sh脚本,我从我的应用程序根目录运行。这个脚本生成我的所有依赖项,用于测试的构建(基于我的app.json buildPaths参数),将目录更改为名为“builds / android /”的目录,其中我保存我的android(phoneGap)项目,然后将项目构建到设备我已通过USB连接:

sencha app resolve http://localhost/careathand/front/mobile/dev/index.html dependencies.json
sencha app build -e testing

# build the application on the device with cordova
cd ../builds/android/
./cordova/debug
./cordova/log | grep Cordova

现在我所要做的就是从我的项目根目录运行以下命令:

sh build.sh

关于答案的回合,但希望这有助于简化您的开发过程并最终解决问题。

答案 1 :(得分:0)

$ sencha package run packager.json

似乎无法在Android 4.x上运行。

你可以试试这个而不是吗?

$ sencha app build native
$ adb install build/[yourProject]/[yourAppName].apk