无法为ionic3应用程序生成APK

时间:2018-07-23 09:42:45

标签: android cordova ionic3 apk

我正在尝试构建apk,但出现此错误:

A problem occurred configuring project 
 ':CordovaLib'.
     Failed to notify project evaluation listener.

com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)

BUILD FAILED in 1s

(node:16884) UnhandledPromiseRejectionWarning: 
    Error: cmd: Command failed with exit code 1 Error output:

FAILURE: Build failed with an exception.

(node:16884) 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:16884) [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.

我也将environment variables设置为JAVA_HOMEANDROID_HOME

1 个答案:

答案 0 :(得分:0)

您的项目中存在语法错误,请检查它。如果您很难找到bug,请新建一个项目:$“ ionic start myApp blank”。不要添加任何代码,然后再构建它。如果再次出现错误,则说明您的环境变量存在问题。