How to build apache cordova project from command line?

前端 未结 4 762
时光取名叫无心
时光取名叫无心 2021-02-14 07:23
  • I\'ve setup apache cordova on my Windows/Cygwin platform.
  • I can create project using the command - cordova create .
  • I have
相关标签:
4条回答
  • 2021-02-14 08:11

    For Android the default location for the APKs is the bin directory

    The location is defined by ant properties in the Android SDK buil.xml

    <import file="${sdk.dir}/tools/ant/build.xml" />
    

    The output apk will be in two formats debug or release

    <property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}-debug.apk" />
    <property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}-release.apk" />
    

    The location of your apk will be something like this:

    • myAndroidApp/bin/myAndroidApp-debug.apk
    • myAndroidApp/bin/myAndroidApp-release.apk
    0 讨论(0)
  • 2021-02-14 08:14

    I was using ant 1.7 which was causing the problem. There was no error message mentioning the version. After changing to Ant 1.8.xx, phonegap was able to install and build the android project.

    0 讨论(0)
  • 2021-02-14 08:15

    You should get a more verbose output by running cordova -d build android.

    Alternatively, to use the underlying cordova-android scripts to build, you can:

    cd platforms/android
    ./cordova/build
    

    OR, to peel away even more layers, you can use the Android ANT script to run the build (which is what the cordova scripts shell out to anyways):

    cd platforms/android
    ant debug
    
    0 讨论(0)
  • 2021-02-14 08:17

    Use cordova compile android

    This will output a debug .apk file into platforms/android/bin

    This works with Cordova 3.3.1

    0 讨论(0)
提交回复
热议问题