Android build fails with Android SDK Build-Tools 31.0.0
See original GitHub issueBug Report
Problem
When I run
cordova build android --release -- --gradleArg=-PcdvBuildToolsVersion=30.0.3
I get the following error:
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Using Android SDK: /Users/kaiputh/Library/Android/sdk
Reading build config file: /Users/kaiputh/code/project/feuerwehr/viewer/build.json
Subproject Path: CordovaLib
Subproject Path: app
Build-tool 31.0.0 is missing DX at /Users/kaiputh/Library/Android/sdk/build-tools/31.0.0/dx
Build-tool 31.0.0 is missing DX at /Users/kaiputh/Library/Android/sdk/build-tools/31.0.0/dx
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':CordovaLib:compileReleaseAidl'.
> Failed to query the value of task ':CordovaLib:compileReleaseAidl' property 'aidlFrameworkProvider'.
> Installed Build Tools revision 31.0.0 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 1s
Command failed with exit code 1: /Users/kaiputh/code/project/feuerwehr/viewer/platforms/android/gradlew cdvBuildRelease -b /Users/kaiputh/code/project/feuerwehr/viewer/platforms/android/build.gradle -PcdvBuildToolsVersion=30.0.3
The build seems to ignore the pinned Android Build-Tools version.
This issue started appearing in our build pipeline between July 19., 13:20 UTC and July 20., 08:38 UTC. I can’t tell when the Android SDK Build-Tools 31.0.0 were release, but cordova-android 10.0.0 was release July 20., 04:17 (timezone?). That may be no coincidence.
What is expected to happen?
The build should succeed.
What does actually happen?
The build fails.
Information
Command or Code
cordova build android --release -- --gradleArg=-PcdvBuildToolsVersion=30.0.3
Environment, Platform, Device
Azure Pipelines, vmImage ‘macOS-10.15’, and local development (see below)
Version information
Cordova Packages:
- cli: 10.0.0
- common: 4.0.2
- create: 3.0.0
- lib: 10.0.0
- common: 4.0.2
- fetch: 3.0.0
- serve: 4.0.0
Project Installed Platforms:
- android: 9.0.0
- ios: 6.2.0
Project Installed Plugins:
- none
Environment:
- OS: macOS 11.4 (20F71) (darwin 20.5.0) x64
- Node: v12.16.3
- npm: 6.14.4
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:26 (9 by maintainers)
Top Results From Across the Web
Android Studio error "Installed Build Tools revision 31.0.0 is ...
First of all, I faced this issue in Android Studio 4.2.2 and you do not need to downgrade the SDK build tool from...
Read more >How to solve Android Studio Error: Installed Build Tools ...
How to solve Android Studio Error: Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.
Read more >Got the error "Installed Build Tools revision 31.0.0 is corrupted."
Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager. Try: Run with --stacktrace option to get the ......
Read more >Fix Error "Installed Build Tools revision 31.0.0 is corrupted"
Solution 1: Downgrade the build tools · Step 1: Go to the project structure (ctrl+alt+shift+S). · Step 2: After clicking on modules, you'll...
Read more >SDK Build Tools release notes - Android Developers
Android SDK Build-Tools is a component of the Android SDK required for building Android apps. It's installed in the <sdk>/build-tools/ directory.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Migrated this to cordova-android for you since this is the package that is responsible for handling the android environment.
Our supported API level on cordova-android@10 is API 30, so build-tools version 30 should work. I’ve placed this issue in the 11.x milestone because generally we only officially support the next API level in a major releases. However, if it is possible to fix this without introducing breaking changes, then we may include it in a future minor release.
Currently cordova-android will look for the latest installed version of build tools, which is probably a bad idea for this very reason. Which is why the uninstalling build-tools 31 is the necessary workaround.
Hey @kputh In order to fix the issue, firstly go to the following location:
C:\Users\User\AppData\Local\Android\Sdk\build-tools\31.0.0
Then find the file d8 (Windows batch file) and rename it to dx.
Then go to:
C:\Users\User\AppData\Local\Android\Sdk\build-tools\31.0.0\lib
Then find the file d8 (Executable Jar File) and rename is to dx.
Your problem will be solved now.
https://stackoverflow.com/questions/68387270/android-studio-error-installed-build-tools-revision-31-0-0-is-corrupted
I have also the same problem which gets resolved with above solution