离子 2 - 错误在 Android Studio 中找不到已安装的 Gradle 版本 [英] ionic 2 - Error Could not find an installed version of Gradle either in Android Studio

查看:31
本文介绍了离子 2 - 错误在 Android Studio 中找不到已安装的 Gradle 版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了 ionic 2 项目并像这样添加了诊断cordova插件:

I create ionic 2 project and add diagnostic cordova plugin like this :

ionic plugin add cordova.plugins.diagnostic

npm install --save @ionic-native/diagnostic

并像这样添加android平台:

and add android platform like this :

ionic platform add android@latest

但是当使用 ionic build android 控制台构建时给我这个错误:

but when build with ionic build android console give me this error :

Error: 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

我尝试手动下载 gradle.3.3-all.zip 并在 platform/android/cordova/lib/builders/GradleBuilder.js 中更改此 distributionUrl var

and I try to download manualy gradle.3.3-all.zip and change this distributionUrl var in platform/android/cordova/lib/builders/GradleBuilder.js

 var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\://services.gradle.org/distributions/gradle-3.3-all.zip'

到:

var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'file:///E:/gradles/gradle-3.3-all.zip';

但不工作,控制台给我最后一个错误.

but not working and console give me last error.

我不知道如何为 android@latest 版本添加 gradle

I dont know how to add gradle for android@latest version

推荐答案

尝试安装 gradle 并将其包含到您的路径中.单击下面的链接以获取手册.https://gradle.org/install

Try installing gradle and include it into your path. Click the link below to get manual. https://gradle.org/install

这篇关于离子 2 - 错误在 Android Studio 中找不到已安装的 Gradle 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆