James Newton
James Newton

Reputation: 7082

meteor run android fails with error "Installed Build Tools revision 31.0.0 is corrupted."

I'm running Meteor 2.3.5 on Ubuntu 20.04. I'm following the tutorial on Cordova: How to build mobile apps using Meteor's Cordova integration. , using the simple ToDo app from the official tutorial.

I believe that I have correctly installed JDK 16.02, Android Studio and Gradle.

When I run meteor run android, the first part is successful:

meteor run android
[[[[[                                         
/media/blackslate/316cbcf3-018d-4506-83b3-5666b5f788cd/blackslate/Repos/Meteor/Tutorial
]]]]]

=> Started proxy.                             
=> Started HMR server.                        
=> Started MongoDB.                           
Checking Java JDK and Android SDK versions   |
ANDROID_SDK_ROOT=/home/blackslate/Android/Sdk (recommended setting)
ANDROID_HOME=/home/blackslate/Android/Sdk (DEPRECATED)
Using Android SDK: /home/blackslate/Android/Sdk
   Starting app on Android Emulator          |
> Connecting to Daemon
=> Started your app.                          

BUILD SUCCESSFUL in 1s

I then see a long series of warnings and mappings, similar to the following:

...
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01

...

Finally, I see an error:

Build-tool 31.0.0 is missing DX at /home/blackslate/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.

The following steps have not solved this problem:

Searching Google for the string Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager. brings up sites like this, which give instructions on how to solve the problem if it occurs when you are working in your own Java project.

When working with Meteor 2.3.5, what steps can I take to solve this issue?

Upvotes: 1

Views: 338

Answers (1)

eltoro0815
eltoro0815

Reputation: 11

https://stackoverflow.com/a/68430992/12547951

(...)

The main problem is the two files missing in SDK build tool 31 that are

  1. dx.bat
  2. dx.jar

The solution is that these files are named d8 in the file location so changing their name to dx will solve the error.

The steps are below.

  1. go to the location

     "C:\Users\user\AppData\Local\Android\Sdk\build-tools\31.0.0"
    
  2. find a file named d8.bat. This is a Windows batch file.

  3. rename d8.bat to dx.bat.

    [after changing d8.jar to dx.jar][1] // now rename d8.jar to dx.jar

    It will be in location:

     "C:\Users\user\AppData\Local\Android\Sdk\build-tools\31.0.0\lib"
    

    Remember AppData is a hidden folder. Turn on hidden items to see the AppData folder.

(...)

Instead of copying these files, I've created symlinks. This can be easily done from a command line:

mklink %ANDROID_HOME%\build-tools\31.0.0\dx.bat %ANDROID_HOME%\build-tools\31.0.0\d8.bat && mklink %ANDROID_HOME%\build-tools\31.0.0\lib\dx.jar %ANDROID_HOME%\build-tools\31.0.0\lib\d8.jar

It's still a workaround though, but the cleanest one.

(...)

Upvotes: 1

Related Questions