您的位置:首页 > 产品设计 > UI/UE

ionic升级到3.0之后,在使用命令:ionic cordova build android或者ionic cordova emulate android会提示以下错误

2018-01-19 15:47 591 查看
gzgchzc博客最新更新地址:http://blog.gzvtc.cc/

(node:4308) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): CordovaError: Could not find an installed version of Gradle either
in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
(node:4308) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre
cated. In the future, promise rejections that are not handled will terminate the
Node.js process with a non-zero exit code.
[15:09:32]  lint finished in 4.67 s


报错的原因:

cordova在6.4.0(cordova-android在6.1.2)之后,会要求安装Gradle,基于Gradle来编译、打包android。(具体版本号有待考证,但是需要安装Gradle属实)

解决办法:

1、手动下载gradle

gradle-x.x-bin.zip (x.x代表版本)

根据需要下载某一版本

地址: (https://services.gradle.org/distributions)

我下载的是gradle-4.1

下载完成后,解压到任意文件夹下

2、添加环境变量

PATH=D:\gradle-4.1\bin

3、关闭cmd

4、打开cmd,输入gradle -v,查看是否安装成功

5、继续使用ionic cordova build android。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ionic
相关文章推荐