【发布时间】:2018-07-09 07:35:07
【问题描述】:
我正在尝试使用 ionic 框架为 android 构建一个 apk,但无法构建一个 apk。 我已经安装了 Android studio 3.1.3 并在 ionic 项目中添加了平台。
ionic cordova add platform android
ionic cordova build android --release
离子信息:
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.9
Cordova Platforms : android 7.0.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v8.11.1
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 7.2.1 Build version 7C1002
Environment Variables:
ANDROID_HOME : /Users/prakash/Documents/adt-bundle-mac-x86_64-20140321/sdk
Misc:
backend : pro
错误信息:
ANDROID_HOME=/Users/prakash/Documents/adt-bundle-mac-x86_64-20140321/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
studio
(node:1272) UnhandledPromiseRejectionWarning: 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
at Object.module.exports.check_gradle (/Users/prakash/IONIC/NABH/platforms/android/cordova/lib/check_reqs.js:150:18)
at StudioBuilder.prepEnv (/Users/prakash/IONIC/NABH/platforms/android/cordova/lib/builders/StudioBuilder.js:216:23)
at Api.module.exports.run (/Users/prakash/IONIC/NABH/platforms/android/cordova/lib/build.js:154:20)
at /Users/prakash/IONIC/NABH/platforms/android/cordova/Api.js:342:43
at _fulfilled (/Users/prakash/IONIC/NABH/platforms/android/cordova/node_modules/q/q.js:854:54)
at self.promiseDispatch.done (/Users/prakash/IONIC/NABH/platforms/android/cordova/node_modules/q/q.js:883:30)
at Promise.promise.promiseDispatch (/Users/prakash/IONIC/NABH/platforms/android/cordova/node_modules/q/q.js:816:13)
at /Users/prakash/IONIC/NABH/platforms/android/cordova/node_modules/q/q.js:624:44
at runSingle (/Users/prakash/IONIC/NABH/platforms/android/cordova/node_modules/q/q.js:137:13)
at flush (/Users/prakash/IONIC/NABH/platforms/android/cordova/node_modules/q/q.js:125:13)
(node:1272) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1272) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
终于安装了 gradle-4.1 文件并解压到以下路径,
/Users/prakash/gradle-4.1
但仍然收到上述消息。请帮助我摆脱困境。 感谢您的建议。
【问题讨论】:
标签: cordova android-studio ionic-framework android-gradle-plugin