Build .apk using monaca CLI or cordova CLI



  • Can I build an .apk in my computer (with Andorid SDK) using monaca CLI or cordova CLI?
    Thank you.



  • @giov Yes, by using the remote build command. Here is a full list of commands:

    create … create a new Monaca project
    preview … runs a local web server for preview
    debug … run app on device using Monaca Debugger
    remote build … build project on Monaca Cloud
    login … sign in to Monaca Cloud
    logout … sign out from Monaca Cloud
    signup … register a new Monaca account
    clone … clone project from the Monaca Cloud
    import … import project from the Monaca Cloud
    upload … upload project to Monaca Cloud
    download … download project from Monaca Cloud
    plugin … manage installed plugins
    proxy … configure proxy to use when connecting to Monaca Cloud



  • I want to build without remote building but using Android SDK installed in my pc. Can I build using CLI or if also possible using Visual Studio 2015?
    Thank you.



  • @giov Yes, but not via the Monaca CLI. You would use the cordova CLI or Visual Studio.



  • @giov Yes its possible (Build with Visual Studio)
    I have made all my applications using visual studio 2015 and Onsen UI (And Onsen UI 2 ) templates for Visual Studio 2015

    https://visualstudiogallery.msdn.microsoft.com/8968a18d-cc94-4ebf-8183-ed0e1f6247f3

    It’s very easy to build an apk. I have a complete tutorial to help you

    https://taco.visualstudio.com/en-us/docs/tutorial-package-publish-readme/



  • Thank you. I have a project exported from Monaca IDE, I copied the www folder in an empty cordova project and then “run android” but it doesn’t work.
    I recieved this error

    BUILD FAILED
    
    Total time: 40.681 secs
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':transformClassesWithDexForDebug'.
    > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Java\jdk1.7.0_55\bin\java.exe'' finished with non-zero exit value 1
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    Error: Error code 1 for command: cmd with args: /s,/c,"C:\Users\asus\Desktop\prova\platforms\android\gradlew cdvBuildDebug -b C:\Users\asus\Desktop\prova\platforms\android\build.gradle -PcdvBuildArch=arm -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
    


  • @giov To be honest, i guess in the output window we have also, other problem (Drawable /icon.png not found)
    I have always this problem. So check also if you have a Drawable folder.

    But if your problem is this , how you told me:

    Perhaps you need to fix the build.gradle adding :

    android {
    
        compileSdkVersion  
        buildToolsVersion ' '
    
        defaultConfig {
           ...
           targetSdkVersion 
        multiDexEnabled true
       }
    }
    


  • I created a splitter template in VS 2015 but i have a error that says error of distribution (impossible to find specificated file).
    With cordova CLI the same project run on my device.



  • @giov
    Seems a problem to find your Keystore Do you have one?
    Set the keystore file
    Build.json file (If your Cordova CLI version is greater than 5.0)

    {
     "android": {
        "release": {
             "keystore":"c:\\Yourkeyfile.keystore",
      "storePassword":"123456",
        "alias":"YourAlias",
      "password":"123456",
             "keystoreType":""
           }
       }
    }
    

    ant.properties file (If your Cordova CLI version is less than 5.0)

    key.store=c:\\Yourkeyfile.keystore
    key.alias=YourAlias
    key.store.password= 123456
    key.alias.password= 123456
    


  • With cordova CLI app runs. In VS 2015 i have a deploy error.
    I installed again Android Studio (with SDK) but nothing



  • @giov do you have java jdk ? Show me the error.when I started with VS and Cordova I had many problems also , but nowadays I have everything working out.



  • jdk 1.8
    If i use VS 2015 my app can’t deploy on device. But with cordova CLI app can deploy and runs.


Log in to reply