1

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:

  • I opened Android Studio, clicked on the More Action link on the Projects pane and chose SDK Manager. This opens a window called Settings For New Projects.
  • I deselected Android 12 Preview (S) 31 and Android 11.0 (R) 30, so that just Android 10.0 (Q) 29 is selected
  • In a Terminal window, I ran meteor remove-platform android, then meteor add-platform android
  • I ran meteor run android again, with the same results.

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?

James Newton
  • 6,623
  • 8
  • 49
  • 113

1 Answers1

1

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.

(...)

eltoro0815
  • 11
  • 3
  • eltoro815's answer may be accurate for Windows, but the question is about Ubuntu. [Another answer](https://stackoverflow.com/a/68597880/1927589) from the same page that their answer was copied from is more helpful. In Ubuntu, the file at `~/Android/Sdk/build-tools/31.0.0/` is called plain `d8` (with no extension). The `jar` file that needs to be renamed is at `Android/Sdk/build-tools/31.0.0/lib/d8.jar`. With these changes, the `meteor run android` command works. – James Newton Aug 31 '21 at 09:53