android - ionic FAILURE:构建失败并出现异常
问题描述
我在我的离子项目中运行这个命令
ionic cordova build android --prod --release
但我收到以下错误:
k\build-tools\31.0.0-rc5\dx.bat
Build-tool 31.0.0 rc5 is missing DX at C:\Users\daees\AppData\Local\Android\Sdk\build-tools\31.0.0-rc5\dx.bat
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
> Installed Build Tools revision 31.0.0-rc5 is corrupted. Remove and install again using the SDK Manager.
* 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 3s
Command failed with exit code 1: C:\Users\daees\Desktop\Ionic project\cam\platforms\android\gradlew cdvBuildRelease -b C:\Users\daees\Desktop\Ionic project\cam\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --release exited with exit code 1.
Re-running this command with the --verbose flag may provide more
information.
我确实删除并添加31.0.0-rc5\
了我的android SDK,但我得到了同样的错误
我还关注了 stackoverflow 的其他线程,但无法获得所需的结果。
我还尝试删除 version 旁边的工具31.0.0-rc5\
,例如29.xx
等,但也没有帮助
我跑了gradle -v
,我得到了这个
------------------------------------------------------------
Gradle 7.1.1
------------------------------------------------------------
Build time: 2021-07-02 12:16:43 UTC
Revision: 774525a055494e0ece39f522ac7ad17498ce032c
Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_291 (Oracle Corporation 25.291-b10)
OS: Windows 10 10.0 amd64
我该怎么办 ?
请帮忙
解决方案
在您的应用程序中转到 platform/android/build.gradle 并找到 defaultBuildToolsVersion
前任。defaultBuildToolsVersion="29.0.2"
现在在 android studio 中转到 SDK 管理器并下载与 build.gradle 中的 defaultBuildToolsVersion 匹配的“Android SDK Build-Tools”版本
这对我有用。
推荐阅读
- image - Xamarin Forms:如何为图标提供精确的圆形背景?
- dynamics-crm - CrmServiceClient 无法实例化
- elasticsearch - Logstash 在 kibana 中的使用
- c# - 如何修复 Unity 检查器中的文本区域框?
- c# - 没有 Internet 连接时 ReadBufferAsync 会引发什么异常
- wavesplatform - data-service 编译运行大于0.18.1的版本
- vue.js - VueJS - 导入js文件中的函数没有被触发
- javascript - Bin Packing Js 使用框旋转实现最佳拟合
- javascript - 使用Pomdoro Clock作为表单组件时如何更改状态?
- r - 使用 str_extract_all 和 unnest 但从 NA 丢失行