ionic 3:FAILURE:构建失败,出现异常

时间:2020-02-15 23:16:28

标签: ionic-framework gradlew

我正在尝试为ionic 3项目创建Android App Bundle。当运行命令 ./ gradlew bundle 时,出现以下错误。在 .bash_profile 文件中,我添加了以下内容:

export ANDROID_HOME=/Users/dome/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools 
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH/:$ANDROID_HOME/platform-tools

Gradle版本为:4.4.1。

错误

iMac:android dome$ ./gradlew bundle

> Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The onesignal-gradle-plugin MUST be before com.android.application!
   Please put onesignal-gradle-plugin first OR update to com.android.tools.build:gradle:3.0.0 or newer!
An exception occurred while trying to find the Android build tools.
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

* Where:
Script '/Users/dome/myAPP/platforms/android/CordovaLib/cordova.gradle' line: 121

* What went wrong:
A problem occurred evaluating project ':app'.
> Unable to determine Android SDK directory.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
iMac:android dome$ 

1 个答案:

答案 0 :(得分:0)

在添加以下出口之后,我没有关闭并重新打开终端,因此出现了问题。现在排序。

export ANDROID_HOME=/Users/dome/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools 
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH/:$ANDROID_HOME/platform-tools