ionic 3 - 错误在 Android Studio 中也找不到安装的 Gradle 版本
Posted
技术标签:
【中文标题】ionic 3 - 错误在 Android Studio 中也找不到安装的 Gradle 版本【英文标题】:ionic 3 - Error Could not find an installed version of Gradle either in Android Studio 【发布时间】:2018-05-20 20:31:45 【问题描述】:我创建 ionic 3 项目并像这样添加文件和传输cordova插件,但无法使用此命令运行android ionic cordova run android --prod
Installing "cordova-plugin-file-transfer" for android
Failed to install 'cordova-plugin-file-transfer': CordovaError: Version of installed plugin: "cordova-plugin-file@4.3.3" does not satisfy dependency plugin requirement "cordova-plugin-file@^5.0.0". Try --force to use installed plugin as dependency.
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:581:33
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:509:49
at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
Failed to restore plugin "cordova-plugin-file-transfer" from config.xml. You might need to try adding it again. Error: Version of installed plugin: "cordova-plugin-file@4.3.3" does not satisfy dependency plugin requirement "cordova-plugin-file@^5.0.0". Try --force to use installed plugin as dependency.
ANDROID_HOME=/Users/reactivespace/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
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
[ERROR] An error occurred while running cordova run android (exit code 1)
【问题讨论】:
【参考方案1】:试试这个:
下载最新的 Gradle 发行版here。
然后使用文件资源管理器创建一个新目录C:\Gradle。
解压此文件夹内的内容。
之后,在系统变量下选择Path,然后点击Edit。为 C:\Gradle\gradle-4.4\bin 添加一个条目。点击确定保存。
重新启动您的计算机,而不是再试一次。
希望这些步骤对您有所帮助。
【讨论】:
以上是关于ionic 3 - 错误在 Android Studio 中也找不到安装的 Gradle 版本的主要内容,如果未能解决你的问题,请参考以下文章
Ionic 3 错误:“文件 google-services.json 丢失。没有它,Google 服务插件无法运行。”在 ionic cordova 构建/准备 android
Ionic 3 中的 Android SDK 平台 26 许可证错误
IONIC 3 [ERROR] 运行 cordova run android 时发生错误(退出代码 1)