Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager

Bitrise Build Issue Report template

Description of the issue

We are preparing our app for Android 12 change by updating our compile sdk and target sdk versions to 31. Our current dev workflow is failing to build and giving and error:

Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.

Funny enough I got this error on my local setup and able to resolve it by following the method described in stackoverflow

Environment:

Where did the issue happen?

Android & Docker, on Ubuntu 20.04

Which build Step causes the issue and which version of the step?

Android Unit Test

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO
  • Does the issue happen sporadically, or every time? : Every time
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : Ever since the first build with API level 31

Local reproduction

Can it be reproduced on your own Mac/PC by following our local debug guide? Please follow at least the first section (“Testing with a full clean git clone”) to make sure to test the state of the code what bitrise.io will get when it does a git clone in the clean environment! If possible please note which sections you tried.

No applicable, able to resolve the issue locally with the method described above.

Local reproduction: Linux / Android (docker based) stack builds

Can it be reproduced by running the build locally, after doing a new git clone of the repository into the /tmp directory and running the build from there with the Bitrise CLI ( Bitrise CLI )? If no, can it be reproduced with Docker (using the same docker images / environment we use on bitrise.io)? Related guide: Redirecting… .

No applicable, able to resolve the issue locally with the method described above.

Build log

Please copy paste the build’s bitrise.io URL here (or if the issue happens somewhere else then the full logs), or if you can’t share the url / log here then send the url or full log through a private channel (e.g. email - Contact us ), with a link to the related Discuss issue.

1 Like

I have the same problem with a flutter app.

I have found solution. Try adding this script before building android apk/aab.

#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x

# write your script here
sdkmanager --install "build-tools;31.0.0" &&

  cd /usr/local/share/android-sdk/build-tools/31.0.0 \
  && mv d8 dx \
  && cd lib  \
  && mv d8.jar dx.jar```
1 Like

Hey thanks for the solution, I had to update the sdk location for me to:

cd /opt/android-sdk-linux/build-tools/31.0.0 \