Installed Build Tools revision 31.0.0 is corrupted

Viewed 1962

I'm using Cordova to build an Android app because I don't know the first thing about Android.

I performed the following steps to create and run a Cordova app:

  • Install JDK 8
  • Install Gradle
  • Install Android Studio
  • Install SDK version 28 using SDK Manager within Android Studio (I'm targeting Fire TV devices)
  • npm install -g cordova
  • cordova create app
  • cd app
  • npm i
  • cordova platform add android@9.0.0 (to target API level 28)
  • cordova run android

This is the end of the output from the last command:

Build-tool 31.0.0 is missing DX at /Users/steve.taylor/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 ':app:compileDebugJavaWithJavac'.
> Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.

I tried uninstalling and reinstalling the SDK, but I still get the error that suggests build tools are corrupted. Are the build tools actually corrupted, or is there some magical undocumented sequence of commands I have to run to get it working?

1 Answers

Looks like the SDK tools are actually broken, or not what Cordova or Gradle expect.

Fix (on macOS):

cp ~/Library/Android/sdk/build-tools/31.0.0/lib/d8.jar \
   ~/Library/Android/sdk/build-tools/31.0.0/lib/dx.jar
Related