1

我正在尝试制作 Famo.us/Angular 应用程序并使用 Cordova 创建 Android 应用程序。我正在使用入门工具包(http://famo.us/integrations/angular/#/download)并进行了一些小的更改以使用 grunt 构建:

要构建应用程序,我执行下一个命令: - bower install - cordovacli build - cordovacli run

构建完成,一切似乎都正常。但是当应用程序在 android 设备上启动时,我有一个白页。在日志中我有这个:

D/CordovaLog( 8978): file:///android_asset/www/bower_components/famous/famous-global.js: Line 434 : Uncaught TypeError: Object [object DOMWindow] has no method 'requestAnimationFrame'

E/Web Console( 8978): Uncaught TypeError: Object [object DOMWindow] has no method 'requestAnimationFrame':434

D/CordovaLog( 8978): file:///android_asset/www/bower_components/angular/angular.js: Line 3906 : Uncaught Error: [$injector:modulerr] Failed to instantiate module integrationApp due to:

D/CordovaLog( 8978): Error: [$injector:modulerr] Failed to instantiate module famous.angular due to:

D/CordovaLog( 8978): ReferenceError: famous is not defined

D/CordovaLog( 8978):     at new <anonymous> (file:///android_asset/www/bower_components/famous-angular/dist/famous-angular.js:21:28)

D/CordovaLog( 8978):     at invoke (file:///android_asset/www/bower_components/angular/angular.js:3966:17)

D/CordovaLog( 8978):     at Object.instantiate (file:///android_asset/www/bower_components/angular/angular.js:3977:23)

D/CordovaLog( 8978):     at provider (file:///android_asset/www/bower_components/angular/angular.js:3833:36)

D/CordovaLog( 8978):     at Object.provider (file:///android_asset/www/bower_components/angular/angular.js:3825:16)

D/CordovaLog( 8978):     at file:///android_asset/www/bower_components/angular/angular.js:3885:37

D/CordovaLog( 8978):     at forEach (file:///android_asset/www/bower_components/angular/angular.js:325:18)

D/CordovaLog( 8978):     at loadModules (file:///android_asset/www/bower_components/angular/angular.js:3872:5)

D/CordovaLog( 8978):     at file:///android_asset/www/bower_components/angular/angular.js:3879:40

D/CordovaLog( 8978):     at forEach (file:///android_asset/www/bower_components/angular/angular.js:325:18)

D/CordovaLog( 8978): http://errors.angularjs.org/1.2.26/$injector/modulerr?p0=famous.angular&p1=ReferenceError%3A%20famous%20is%20not%20defined%0A%20%20%20%20at%20new%20%3Canonymous%3E%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Fbower_components%2Ffamous-angular%2Fdist%2Ffamous-angular.js%3A21%3A28)%0A%20%20%20%20at%20invoke%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Fbower_components%2Fangular%2Fangular.js%3A3966%3A17)%0A%20%20%20%20at%20Object.instantiate%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Fbower_components%2Fangular%2Fangular.js%3A3977%3A23)%0A%20%20%20%20at%20provider%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Fbower_components%2Fangular%2Fangular.js%3A3833%3A36)%0A%20%20%20%20at%20Object.provider%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Fbower_components%2Fangular%2Fangular.js%3A3825%3A16)%0A%20%20%20%20at%20file%3A%2F%2F%2Fandroid_asset%2Fwww%2Fbower_components%2Fangular%2Fangular.js%3A3885%3A37%0A%20%20%20%20at%20forEach%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Fbower_components%2Fangular%2Fangular.js%3A325%3A18)%0A%20%20%20%20at%20loadModules%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Fbower_components%2Fangular%2Fangular.js%3A3872%3A5)%0A%20%20%20%20at%20file%3A%2F%2F%2Fandroid_asset%2Fwww%2Fbower_components%2Fangular%2Fangular.js%3A3879%3A40%0A%20%20%20%20at%20forEach%20(file%3A%2F%2F%2Fandroid_asset%2Fwww%2Fbower_components%2Fangular%2Fangular.js%3A325%3A18)

如果我看一下 index.html,包括著名的并且路径很好:

<!-- bower:js -->
    <script src="bower_components/underscore/underscore.js"></script>
    <script src="bower_components/angular/angular.js"></script>
    <script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
    <script src="bower_components/angular-touch/angular-touch.js"></script>

    <script src="bower_components/famous/famous-global.js"></script>
    <script src="bower_components/famous-angular/dist/famous-angular.js"></script>
    <!-- endbower -->

我觉得“着名-angular.js”找不到“着名”,但它包含在“着名-global.js”中。

PS:如果我在我的网络浏览器中构建它,它工作正常。

有人有想法吗?请分享。

4

1 回答 1

2

感谢@pasine 的帮助。

问题的根源是android的版本。

'requestAnimationFrame' 仅支持 android 4.4+ 版本。由第一个产生的下一个错误。

我在 android 4.4 上没有这些错误。

Famo.us 兼容性提醒:

  • iOS:4.3+
  • 安卓:果冻豆+

这个问题有解决方法:

于 2014-10-29T15:31:54.613 回答