我对此很陌生,一直在使用 cordova 将网络应用程序转换为移动应用程序
如何解决这个问题,我已经安装了构建工具34.0.0。和最新的 36.0.0-rc1 并尝试使用不同的版本。梯度
C:\App\OS>cordova build android
Checking Java JDK and Android SDK versions
ANDROID_HOME=C:\Program Files\Android\Android Studio\bin (recommended setting)
ANDROID_SDK_ROOT=C:\Users\Clark\AppData\Local\Android\Sdk (DEPRECATED)
Using Android SDK: C:\Program Files\Android\Android Studio\bin
BUILD SUCCESSFUL in 1s
1 actionable task: 1 up-to-date
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
* Where:
Script 'C:\App\OS\platforms\android\CordovaLib\cordova.gradle' line: 73
* What went wrong:
A problem occurred evaluating script.
> No installed build tools found. Please install the Android build tools version 34.0.0.
* 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 1s
Command failed with exit code 1: C:\App\OS if (highestBuildToolsVersion.isLowerThan(minBuildToolsVersionString)) {
throw new RuntimeException("""
No usable Android build tools found. Highest ${minBuildToolsVersion.getMajor()}.x installed version is
${highestBuildToolsVersion.getOriginalString()}; Recommended version
is ${minBuildToolsVersionString}.
""".replaceAll(/\s+/, ' ').trim())
}\platforms\android\tools\gradlew.bat cdvBuildDebug
if (highestBuildToolsVersion.isLowerThan(minBuildToolsVersionString)) {
throw new RuntimeException("""
No usable Android build tools found. Highest ${minBuildToolsVersion.getMajor()}.x installed version is
${highestBuildToolsVersion.getOriginalString()}; Recommended version
is ${minBuildToolsVersionString}.
""".replaceAll(/\s+/, ' ').trim())
}
您看到的错误表明您的 Android 构建工具已过时或未正确安装。具体来说,它要求 Android Build Tools 版本 34.0.0 或更高版本。
要解决该问题,请按照以下步骤操作,
第 01 步:- 更新 Android 构建工具
步骤 02:- 验证构建工具版本
安装后,确保您的 build.gradle 文件指向构建工具的正确版本。
寻找类似这样的行,
梯度 复制代码 buildTools版本“34.0.0”
如果不存在或设置为旧版本,请更新它。
步骤 03 :- 设置环境变量(如有必要):确保您的环境变量指向正确的 Android SDK 位置:
ANDROID_HOME 或 ANDROID_SDK_ROOT 应设置为 C:\Users\Clark\AppData\Local\Android\Sdk (确保此路径正确)。
步骤 04:- 清洁和重建:
在项目目录中运行以下命令:
“科尔多瓦清洁安卓” “cordova 构建 Android”
这应该可以解决缺少构建工具的问题并允许构建过程成功完成。