Reputation: 1458
I am running this command in my ionic project
ionic cordova build android --prod --release
but I am getting the following error:
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.
I did remove and add 31.0.0-rc5\
in my android SDK, but I got the same error
I also followed other threads of stackoverflow, but wasn't able to get the required results.
I also tried removing tools next to version 31.0.0-rc5\
, like 29.xx
etc, but didnt help either
I ran gradle -v
and I got this
------------------------------------------------------------
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
What do I do ?
Please help
Upvotes: 3
Views: 2090
Reputation: 368
Because Android Build Tools 31.0.0 miss dx files. You can check this link for solution
Upvotes: 0
Reputation: 186
I Resolved it by not using the newest build tools, instead opted for 29.0.3 and 30.0.3.
Upvotes: 0
Reputation: 11
Within your app go to platform/android/build.gradle and find defaultBuildToolsVersion
ex. defaultBuildToolsVersion="29.0.2"
Now in android studio go to the SDK manager and download the "Android SDK Build-Tools" version that matches defaultBuildToolsVersion in build.gradle
This worked for me.
Upvotes: 1