Install gradle for using in cordova build android

前端 未结 2 1877
无人及你
无人及你 2020-12-08 08:40

I have installed cordova and android sdk on linux mint 17, and downloaded gradle 2.4 (bin) and extracted it and set path to it, now I can get gradle -v from terminal, its ok

2条回答
  •  忘掉有多难
    2020-12-08 09:01

    I had figured out the reason:
    See the code GradleBuilder.prototype.prepEnv in $PROJECT_ROOT/platforms/android/cordova/lib/builders/GradleBuilder.js。

    A quick fix :

    export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL=file:///local/path/to/gradle-2.4-all.zip
    cordova run android
    

    Notice:

    1. This will unzip to $USER_HOME/.gradle/wrapper/dists/gradle-2.4-all/5i28vc5j9c3ssbtreg4518ujvp/gradle-2.4 .
    2. export command must always be executed before run cordova.

    If the network is slow, you download gradle-2.2.1-all.zip manually, then use this method once.

    Also, you can change GradleBuilder.js's code or request a enhancement/issue.

提交回复
热议问题