Search code examples
sencha-touchsencha-cmd

Issues with Sencha CMD v5.0.1.231 and beta v5.0.2.250 and phonegap


It has been awhile since I updated my Sencha CMD (currently running v4.0.4.84). I had successfully updated to Sencha CMD v5.0.1.231, however, while trying to init phonegap

sencha phonegap init com.example.www my-app my-app

I get the following errors in my log:

Sencha Cmd v5.0.1.231 [INF] Creating App [ERR] The following error occurred while executing this line: /bin/Sencha/Cmd/5.0.1.231/extensions/cmd-packager/cmd-packager.plugin.xml:131: org.mozilla.javascript.EvaluatorException: Function importClass must be called with a class; had "[JavaPackage java.nio.charset.StandardCharsets]" instead. (anonymous#3)

The same happens with beta v5.0.2.250.

I checked my java version and it is the latest (Java 7 Update 67)


Solution

  • After much tinkering, I have managed to get a clean build with no errors.

    Here are my steps:

    1. remove phonegap or cordova: sencha-4.0.4.84 cordova remove
    2. Upgrade to new sencha cmd: sencha upgrade
    3. Update app: sencha app upgrade
    4. Add your build settings to your app.json

    ```

    "builds": {
    "web": {
        "default": true
    },
    "native": {
        "packager": "cordova",
        "cordova": {
            "config": {
                // Uncomment the line below and add the platforms you wish to build for
                //"platforms": "ios android",
                "id": "com.company.myapp",
                "name": "BaseCordova231"
            }
        }
    }
    

    }

    1. Build your mobile app: sencha app build native

    With that, it compiled without any errors, and the app runs in the simulator. Only problem is nothing is showing up.... I guess sencha CMD needs to catch up with my current phonegap v3.5.0-0.21.14.

    I think the key problem I had was that I didn't remove cordova/phonegap when Sencha CMD was in v4.0.4.84.

    Well, I will take a break from Sencha CMD 5, and use the reliable v4.0.4.84 for now.