首页/Ionic/列表

ionic build android (或cordova build android)报错:Error: Could not find an inst

来源:  2018-04-11 11:10:24    评论:0点击:

执行ionic build android (或cordova build android)打包时报错的解决方案

错误如下:

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
 
解决方案:
如果安装了Android Studio,请设置gradle为 Android Studio目录下的gradel。

其他办法:

1、手动下载gradle
gradle-x.x-bin.zip (x.x代表版本)
根据需要下载某一版本
地址:
(https://services.gradle.org/distributions)

2、添加环境变量
    PATH=C:\Program Files\gradle-x.x\bin
1
3、关闭cmd或powershell窗口
4、重新打开,输入gradle -v,查看gradle安装成功与否
5、重新build



GitHub地址: https://github.com/iamyong
来源:https://blog.csdn.net/CapMiachael/article/details/73289478







cordova Android失败:“Could not find an installed version of Gradle”怎么办?






我使用最新的工具来创建Cordova Android项目。遵循这里的教程:

$ cordova create myApp com.myCompany.myApp myApp
$ cd myApp
$ cordova platform add android@6.2.1 --save
$ cordova requirements android --verbose
但结果是:

Running command: android list targets
Command finished with error code 0: android list,targets

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-25,android-23
Gradle: not installed
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
Error: CordovaError: Some of requirements check failed
    at /usr/local/nodejs_next/lib/node_modules/cordova/src/cli.js:401:45
    at _fulfilled (/usr/local/nodejs_next/lib/node_modules/cordova/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/local/nodejs_next/lib/node_modules/cordova/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/usr/local/nodejs_next/lib/node_modules/cordova/node_modules/q/q.js:749:13)
    at /usr/local/nodejs_next/lib/node_modules/cordova/node_modules/q/q.js:557:44
    at flush (/usr/local/nodejs_next/lib/node_modules/cordova/node_modules/q/q.js:108:17)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)








如果你安装了android studio,那么你可以看一下:

export PATH="$PATH:/home/<username>/android-studio/gradle/<gradle-4.0>/bin" 

这解决了我的问题。


 

Ubuntu下

通过

sudo apt-get install gradle

在Ubuntu中安装最新版本的gradle的命令。

sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update
sudo apt-get install gradle-ppa

https://wtanaka.com/node/8079

如果不起作用,请尝试:

export PATH=$PATH:/opt/gradle/gradle-3.5/bin

更多信息:

https://askubuntu.com/questions/915980/package-is-installed-and-is-not-detected-gradle/915993#915993

对于CentOS

gradleCentOS 的安装说明

https://gist.github.com/parzonka/9371885



 


为您推荐

友情链接 |九搜汽车网 |手机ok生活信息网|ok生活信息网|ok微生活
 Powered by www.360SDN.COM   京ICP备11022651号-4 © 2012-2016 版权