开发者问题收集

ionic cordova 构建 android-失败

2017-10-07
1631

尝试为 Android 平台构建 ionic 应用程序时,我在安装 Android 构建工具时收到以下错误,但我已在 PATH 变量和 ANDROID_HOME 中配置了 sdkmanager。请帮助我。

系统变量:

%ANDROID_HOME% = K:/android-sdk %PATH% = %APTH%/%ANDROID_HOME%/tools/bin

%ANDROID_HOME%/tools/bin/sdkmanager --list 的输出

Available Updates:
  ID      | Installed | Available
  ------- | -------   | -------
  tools   | 26.0.1    | 26.1.1
done

错误:

[21:12:35]  lint finished in 4.37 s
× Running command - failed!
[ERROR] An error occurred while running cordova build android (exit code 1):


        (truncated) ... eLauncher$1.execute(DefaultGradleLauncher.java:161)
                at org.gradle.initialization.DefaultGradleLauncher$1.execute(DefaultGradleLauncher.java:158)
                at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
                at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)


        FAILURE: Build failed with an exception.

        * Where:
        Script 'K:\mobileApp\platforms\android\CordovaLib\cordova.gradle' line:
        64

        * What went wrong:
        A problem occurred evaluating root project 'android'.
        > No installed build tools found. Install the Android build tools version 19.1.0 or higher.
2个回答

扩展您的 PATH 变量以指向 Android 平台工具。

%PATH% = %PATH%/%ANDROID_HOME%/platform-tools

希望这能解决您的错误!

Lokkesh
2017-10-09

config.xml 中检查 Android 版本

它应该是这样的:

 <engine
  name="android"
  spec="^6.2.3"/>
Lokkesh
2017-10-08