Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    2
    Vote Rating
    0
    gokhales is on a distinguished road

      0  

    Default Sencha touch native build :TypeError: Cannot read property "length" from undefined

    Sencha touch native build :TypeError: Cannot read property "length" from undefined


    REQUIRED INFORMATION




    Sencha Cmd version(s) tested:
    • Sencha Cmd 3.0.2.288
    Operating System
    • Win7 Pro
    Framework used:
    • Sencha Touch 2.1.1
    Description:
    • I have built a small application using sencha architect (targeted to sencha touch 2.1.x) and it works and runs successfully on a desktop browser (chrome) however when i followed the steps to compile it for native andriod platform it fails with the error below:
    • [ERR]
      [ERR] BUILD FAILED
      [ERR] com.sencha.exceptions.BasicException: The following error occurr
      ed while executing this line:
      [ERR] C:\projects\ExtJSProtoType\MyTestApp\.sencha\app\build-impl.xml:
      137: com.sencha.exceptions.ExScript: TypeError: Cannot read property "length" fr
      om undefined (C:\SenchaCommand\Sencha\Cmd\3.0.2.288/ant/ant-util.js#459) each
      (C:\SenchaCommand\Sencha\Cmd\3.0.2.288/ant/ant-util.js:459) runAppBuild (x-app
      -build:125) [anonymous] (x-app-build:545) x_app_build (x-app-build:543) <s
      cript> (anonymous:1)
    Steps to reproduce the problem:

    I have a small application built using sencha architect and i compile it using the command line shown below:
    C:\projects\ExtJSProtoType\MyTestApp>sencha app build native ..\MytestApp\packager.json

    My application directory is C:\projects\ExtJSProtoType\MyTestApp and touch 2.1.x sdk is inside this directory and its path is C:\projects\ExtJSProtoType\MyTestApp\touch



    Code:
    C:\projects\ExtJSProtoType\MyTestApp>sencha app build native ..\MytestApp\packager.json > log.txt



    Code:
    Sencha Cmd v3.0.2.288
    [INF]        
    [INF]        init-properties:
    [INF]        
    [INF]        init-sencha-command:
    [INF]        
    [INF]        init:
    [INF]        
    [INF]        -before-app-build:
    [INF]        
    [INF]        app-build-impl:
    [INF]        
    [INF]        native:
    [INF]        
    [INF]        -before-init-local:
    [INF]        
    [INF]        -init-local:
    [INF]        
    [INF]        -after-init-local:
    [INF]        
    [INF]        init-local:
    [INF]        
    [INF]        find-cmd:
    [INF]        
    [INF]        -before-init:
    [INF]        
    [INF]        -init:
    [INF]        
    [INF]        -after-init:
    [INF]        
    [INF]        init:
    [INF]        
    [INF]        -before-build:
    [INF]        
    [INF]        sass:
    [INF]        
    [INF]        -before-sass:
    [INF]        
    [INF]        -sass:
    [INF]        [shellscript] 
    [INF]        [shellscript] C:\projects\ExtJSProtoType\MyTestApp\resources\sass>compass compile --boring --force 
    [INF]        [shellscript] identical ../css/app.css 
    [INF]        
    [INF]        -after-sass:
    [INF]        
    [INF]        page:
    [INF]        
    [INF]        -before-page:
    [INF]        
    [INF]        -page:
    [INF]        building application
    [INF]        Deploying your application to C:\projects\ExtJSProtoType\MyTestApp\build\MyTestApp\package
    [INF]        Copied C:\projects\ExtJSProtoType\MyTestApp\.\app.js to C:\projects\ExtJSProtoType\MyTestApp\build\MyTestApp\package\app.js
    [INF]        Copied C:\projects\ExtJSProtoType\MyTestApp\.\app\controller\maincontroller.js to C:\projects\ExtJSProtoType\MyTestApp\build\MyTestApp\package\app\controller\maincontroller.js
    [INF]        Copied C:\projects\ExtJSProtoType\MyTestApp\.\app\model\usermodel.js to C:\projects\ExtJSProtoType\MyTestApp\build\MyTestApp\package\app\model\usermodel.js
    [INF]        Copied C:\projects\ExtJSProtoType\MyTestApp\.\app\view\mainnavigator.js to C:\projects\ExtJSProtoType\MyTestApp\build\MyTestApp\package\app\view\mainnavigator.js
    [INF]        Copied C:\projects\ExtJSProtoType\MyTestApp\.\app\view\overlaypanel.js to C:\projects\ExtJSProtoType\MyTestApp\build\MyTestApp\package\app\view\overlaypanel.js
    [INF]        Copied C:\projects\ExtJSProtoType\MyTestApp\.\app\view\UsersPanel.js to C:\projects\ExtJSProtoType\MyTestApp\build\MyTestApp\package\app\view\UsersPanel.js
    [INF]        Copied C:\projects\ExtJSProtoType\MyTestApp\.\app\store\usersstore.js to C:\projects\ExtJSProtoType\MyTestApp\build\MyTestApp\package\app\store\usersstore.js
    [INF]        Copied C:\projects\ExtJSProtoType\MyTestApp\.\resources\css\app.css to C:\projects\ExtJSProtoType\MyTestApp\build\MyTestApp\package\resources\css\app.css
    [ERR]        
    [ERR]        BUILD FAILED
    [ERR]        com.sencha.exceptions.BasicException: The following error occurred while executing this line:
    [ERR]        C:\projects\ExtJSProtoType\MyTestApp\.sencha\app\build-impl.xml:137: com.sencha.exceptions.ExScript: TypeError: Cannot read property "length" from undefined (C:\SenchaCommand\Sencha\Cmd\3.0.2.288/ant/ant-util.js#459)   each (C:\SenchaCommand\Sencha\Cmd\3.0.2.288/ant/ant-util.js:459)   runAppBuild (x-app-build:125)   [anonymous] (x-app-build:545)   x_app_build (x-app-build:543)   <script> (anonymous:1)
    [ERR]            at com.sencha.exceptions.BasicException.wrap(BasicException.java:43)
    [ERR]            at com.sencha.cli.Command.dispatch(Command.java:104)
    [ERR]            at com.sencha.cli.Commands.dispatch(Commands.java:49)
    [ERR]            at com.sencha.cli.AbstractCommand.dispatch(AbstractCommand.java:182)
    [ERR]            at com.sencha.ant.SenchaCommandTask.doExecute(SenchaCommandTask.java:69)
    [ERR]            at com.sencha.ant.BaseAntTask.execute(BaseAntTask.java:22)
    [ERR]            at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    [ERR]            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [ERR]            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    [ERR]            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    [ERR]            at java.lang.reflect.Method.invoke(Unknown Source)
    [ERR]            at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    [ERR]            at org.apache.tools.ant.Task.perform(Task.java:348)
    [ERR]            at org.apache.tools.ant.Target.execute(Target.java:392)
    [ERR]            at org.apache.tools.ant.Target.performTasks(Target.java:413)
    [ERR]            at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    [ERR]            at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
    [ERR]            at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    [ERR]            at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    [ERR]            at com.sencha.ant.AntRunner.run(AntRunner.java:156)
    [ERR]            at com.sencha.ant.AntRunner.run(AntRunner.java:72)
    [ERR]            at com.sencha.command.BasePluginCommands$BasePluginCommand.run(BasePluginCommands.java:94)
    [ERR]            at com.sencha.command.BasePluginCommands$BasePluginCommand.run(BasePluginCommands.java:98)
    [ERR]            at com.sencha.command.BasePluginCommands$BaseNamePathCommand.run(BasePluginCommands.java:142)
    [ERR]            at com.sencha.command.app.AppCommands$BuildCommand.execute(AppCommands.java:116)
    [ERR]            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [ERR]            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    [ERR]            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    [ERR]            at java.lang.reflect.Method.invoke(Unknown Source)
    [ERR]            at com.sencha.cli.Command.dispatch(Command.java:78)
    [ERR]            at com.sencha.cli.Commands.dispatch(Commands.java:49)
    [ERR]            at com.sencha.cli.Commands.dispatch(Commands.java:49)
    [ERR]            at com.sencha.command.Sencha.main(Sencha.java:71)
    [ERR]        Caused by: C:\projects\ExtJSProtoType\MyTestApp\.sencha\app\build-impl.xml:144: The following error occurred while executing this line:
    [ERR]        C:\projects\ExtJSProtoType\MyTestApp\.sencha\app\build-impl.xml:137: com.sencha.exceptions.ExScript: TypeError: Cannot read property "length" from undefined (C:\SenchaCommand\Sencha\Cmd\3.0.2.288/ant/ant-util.js#459)   each (C:\SenchaCommand\Sencha\Cmd\3.0.2.288/ant/ant-util.js:459)   runAppBuild (x-app-build:125)   [anonymous] (x-app-build:545)   x_app_build (x-app-build:543)   <script> (anonymous:1)
    [ERR]            at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:551)
    [ERR]            at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:444)
    [ERR]            at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
    [ERR]            at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    [ERR]            at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
    [ERR]            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    [ERR]            at java.lang.reflect.Method.invoke(Unknown Source)
    [ERR]            at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    [ERR]            at org.apache.tools.ant.Task.perform(Task.java:348)
    [ERR]            at org.apache.tools.ant.Target.execute(Target.java:392)
    [ERR]            at org.apache.tools.ant.Target.performTasks(Target.java:413)
    [ERR]            at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    [ERR]            at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
    [ERR]            at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    [ERR]            at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    [ERR]            at com.sencha.ant.AntRunner.run(AntRunner.java:156)
    [ERR]            at com.sencha.ant.AntRunner.run(AntRunner.java:80)
    [ERR]            at com.sencha.command.ant.AntCommand.execute(AntCommand.java:75)
    [ERR]            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [ERR]            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    [ERR]            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    [ERR]            at java.lang.reflect.Method.invoke(Unknown Source)
    [ERR]            at com.sencha.cli.Command.dispatch(Command.java:78)
    [ERR]            ... 31 more
    [ERR]        Caused by: C:\projects\ExtJSProtoType\MyTestApp\.sencha\app\build-impl.xml:137: com.sencha.exceptions.ExScript: TypeError: Cannot read property "length" from undefined (C:\SenchaCommand\Sencha\Cmd\3.0.2.288/ant/ant-util.js#459)   each (C:\SenchaCommand\Sencha\Cmd\3.0.2.288/ant/ant-util.js:459)   runAppBuild (x-app-build:125)   [anonymous] (x-app-build:545)   x_app_build (x-app-build:543)   <script> (anonymous:1)
    [ERR]            at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116)
    [ERR]            at org.apache.tools.ant.Task.perform(Task.java:348)
    [ERR]            at org.apache.tools.ant.Target.execute(Target.java:392)
    [ERR]            at org.apache.tools.ant.Target.performTasks(Target.java:413)
    [ERR]            at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    [ERR]            at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
    [ERR]            at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    [ERR]            at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
    [ERR]            ... 52 more
    [ERR]        Caused by: com.sencha.exceptions.ExScript: TypeError: Cannot read property "length" from undefined (C:\SenchaCommand\Sencha\Cmd\3.0.2.288/ant/ant-util.js#459)   each (C:\SenchaCommand\Sencha\Cmd\3.0.2.288/ant/ant-util.js:459)   runAppBuild (x-app-build:125)   [anonymous] (x-app-build:545)   x_app_build (x-app-build:543)   <script> (anonymous:1)
    [ERR]            at com.sencha.util.JavaScriptHost.eval(JavaScriptHost.java:74)
    [ERR]            at com.sencha.ant.ScriptTask.executeScript(ScriptTask.java:92)
    [ERR]            at org.apache.tools.ant.taskdefs.optional.script.ScriptDefBase.execute(ScriptDefBase.java:50)
    [ERR]            at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    [ERR]            at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
    [ERR]            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    [ERR]            at java.lang.reflect.Method.invoke(Unknown Source)
    [ERR]            at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    [ERR]            ... 59 more
    [ERR]        Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "length" from undefined (C:\SenchaCommand\Sencha\Cmd\3.0.2.288/ant/ant-util.js#459)
    [ERR]            at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3785)
    [ERR]            at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3763)
    [ERR]            at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3791)
    [ERR]            at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3810)
    [ERR]            at org.mozilla.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3823)
    [ERR]            at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1508)
    [ERR]            at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1398)
    [ERR]            at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)
    [ERR]            at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
    [ERR]            at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
    [ERR]            at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3178)
    [ERR]            at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
    [ERR]            at org.mozilla.javascript.Context.evaluateString(Context.java:1111)
    [ERR]            at com.sencha.util.JavaScriptHost.eval(JavaScriptHost.java:67)
    [ERR]            ... 66 more
    [ERR]        
    [ERR]        Total time: 19 seconds
    [ERR]        com.sencha.exceptions.BasicException: The following error occurred while executing this line:
    C:\projects\ExtJSProtoType\MyTestApp\.sencha\app\build-impl.xml:137: com.sencha.exceptions.ExScript: TypeError: Cannot read property "length" from undefined (C:\SenchaCommand\Sencha\Cmd\3.0.2.288/ant/ant-util.js#459)
       each (C:\SenchaCommand\Sencha\Cmd\3.0.2.288/ant/ant-util.js:459)
       runAppBuild (x-app-build:125)
       [anonymous] (x-app-build:545)
       x_app_build (x-app-build:543)
       <script> (anonymous:1)

    The files which i have customized or modified after they were generated by following getting started with touch applications article (http://docs.sencha.com/touch/2-0/#!/...etting_started) are:


    .\MyTestApp\app.json
    Only posting modified or added sections
    Code:
       /**     * The application's namespace, used by Sencha Command to generate classes
         */
        "name": "MyTestApp",
    
    
        /**
         * The file path to this application's front HTML document, relative to this app.json file
         */
        "indexHtmlPath": "app.html",
       "js": [        {
                "path": "touch/sencha-touch.js",
                "x-bootstrap": true
            },
            {
                "path": "app.js",
                "bundle": true,  /* Indicates that all class dependencies are concatenated into this file when build */
                "update": "delta"
            },
            {
                "path": "app/controller/maincontroller.js",
                "update": "delta"
            },
            {
                "path": "app/model/usermodel.js",
                "update": "delta"
            },
            {
                "path": "app/view/mainnavigator.js",
                "update": "delta"
            },
            {
                "path": "app/view/overlaypanel.js",
                "update": "delta"
            },
            {
                "path": "app/view/UsersPanel.js",
                "update": "delta"
            },
            {
                "path": "app/store/usersstore.js",
                "update": "delta"
            }
            
        ],
    .\MyTestApp\packager.json
    Code:
    "applicationName":"MyTestApp",
    
    
        /**
         * @cfg {String} applicationId
         * This is the name namespace for your application. On IOS, this should match the name of your application in the Apple Provisioning Portal.
         */
        "applicationId":"com.netiq.TestApp",
    /**
         * @cfg {String} inputPath
         * @required
         * This is location of your Sencha Touch 2 application, relative to this configuration file.
         */
        "inputPath":"C:/projects/ExtJSProtoType/Mytestapp",
    
    
        /**
         * @cfg {String} outputPath
         * @required
         * This is where the built application file with be saved. Make sure that output path is not in your input path, you may get into endless recursive copying
         */
        "outputPath":"C:/projects/ExtJSProtoType/build",
    
    
        /**
         * @cfg {String} configuration
         * @required
         * This is configuration for your application. `Debug` should always be used unless you are submitting your app to an online
         * store - in which case `Release` should be specified.
         */
        "configuration":"Debug",
    /**
         * @cfg {String} platform
         * @required
         * This is the platform where you will be running your application. Available options are:
         *  - iOSSimulator
         *  - iOS
         *  - Android
         *  - AndroidEmulator
         */
        "platform":"Android",
    /**
         * @cfg {String} sdkPath
         * This is the path to the Android SDK, if you are developing an Android application.
         */
        "sdkPath":"C:/iqsrc/pg/src/ui/AndroidSDK/adt-bundle-windows-x86_64-20130219/sdk",
    
    
        /**
         * @cfg {String} androidAPILevel
         * This is android API level, the version of Android SDK to use, you can read more about it here: http://developer.android.com/guide/appendix/api-levels.html.
         * Be sure to install corresponding platform API in android SDK manager (android_sdk/tools/android)
         */
        "androidAPILevel":"17",
    .\MyTestApp\app.js
    Code:
    Ext.application({
        viewport: {
            scrollable: true
        },
    
    
        models: [
            'UserModel'
        ],
        stores: [
            'UsersStore'
        ],
        views: [
            'MainNavigator',
            'UsersPanel',
            'OverlayPanel'
        ],
        name: 'MyTestApp',
        controllers: [
            'MainController'
        ],
    
    
        launch: function() {
            Ext.Viewport.add( 
            [
            {
                xtype: 'mainNavigator',
                fullscreen: true
            },
            {
                xtype: 'overlayPanel'
            }    
            ]
            );
        }
    
    
    });
    .\MyTestApp\app.html
    Code:
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Mytestapp</title>
         <script id="microloader" type="text/javascript" src="touch/microloader/development.js"></script>
        
        <!--<link rel="stylesheet" href="http://10.21.21.26/AndroidTest/touch/resources/css/sencha-touch.css">-->
        <!--<script type="text/javascript" src="app.js"></script>-->
        <script type="text/javascript">
            if (!Ext.browser.is.WebKit) {
                alert("The current browser is unsupported.\n\nSupported browsers:\n" +
                    "Google Chrome\n" +
                    "Apple Safari\n" +
                    "Mobile Safari (iOS)\n" +
                    "Android Browser\n" +
                    "BlackBerry Browser"
                );
            }
        </script>
    </head>
    The result that was expected:
    • .apk file should have been created in native build folder.
    The result that occurs instead:
    • The build fails with error mentioned above.
    HELPFUL INFORMATION


    Screenshot or Video:
    • attached
    See this URL for live test case: http://




    Debugging already done:


    Many of the process steps provided by Sencha Cmd reside in generated code that lives in folders of your application (like .sencha/app/build.xml) or in scripts that ship in Sencha Cmd (CmdInstallDir/plugins/ext/current/plugin.xml or the "touch" folder instead of "ext").
    • None
    Possible fix:
    • not provided (perhaps there is a bug in a generated file or script)

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,604
    Vote Rating
    818
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Can I get a fully, locally runnable test case?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1