Monaca CLI fetching outdated platform files for Cordova?



  • I had trouble trying to get my project to build using Android SDK.

    FYI, I am using Cordova 6.5.0. The latest Cordova is 7.0.0. Monaca CLI platform add seems to be fetching an earlier Cordova version 4.x.x. Here’s a summary of my system setup:

    OS: Windows 7
    Cordova: 6.5.0
    Node: 6.10.2
    Android SDK tools: 26.0.1
    Android Platform tools: 25.0.4

    monaca create helloworld 
    # choose AngularJS 1, splitter template project
    
    monaca preview 
    # OK tested look fine in web browser
    
    monaca platform add android
    
    monaca build 
    # This fails the prereq_checks because the recent Android SDK tools have changed, it complains that  the Android SDK is not installed/found.
    

    So I tried another way to bypass the Cordova platform files that monaca platform add android is getting for me. I use the cordova cli directly:

    cordova platform add android
    cordova build
    

    This fixes the problem of outdated Cordova Android platform files fetched by monaca platform add android. The build went fine.

    Then I do a cordova run (monaca run also works similarly) to run the debug build Android app on my phone. The app gets deployed and run as expected.

    May I know if anyone has tested the latest Monaca CLI (2.2.1) and Onsen UI 2 (2.2.4) with Cordova 6.x.x and the latest 7.0.0?


  • Monaca

    This post is deleted!

  • Monaca

    Monaca CLI uses it’s own version of Cordova. At the moment, it uses cordova ^5.0.0 which fetches cordova-android@4.1.1. The latest cordova 7.0.1 fetches cordova-android@~6.2.2.
    In general, monaca platform add and cordova platform add are actually the same command, so feel free to use the cordova one to fetch the desired version of the platform. Just keep in mind that some cloud features, like remote build, may not work due to a not compatible platform version.



  • @Andi said:

    Monaca CLI uses it’s own version of Cordova. At the moment, it uses cordova ^5.0.0 which fetches cordova-android@4.1.1. The latest cordova 7.0.1 fetches cordova-android@~6.2.2.
    In general, monaca platform add and cordova platform add are actually the same command, so feel free to use the cordova one to fetch the desired version of the platform. Just keep in mind that some cloud features, like remote build, may not work due to a not compatible platform version.

    In this case, on my machine, cordova-android@4.1.1 seems to have problem finding and executing the appropriate Android SDK tools. cordova-android@~6.2.2 is fine though.

    • Android SDK tools: 26.0.1
    • Android Platform tools: 25.0.4

Log in to reply