Android builds on Catalina

Hi there,

This just started happening when building Android on Catalina for mac. We are using platform 2.8.4. See below:

2020-01-22 09:23:10,346 [   INFO] Aligning apk
2020-01-22 09:23:10,346 [  DEBUG] Running: '/Users/leifullman/Library/Android/sdk/build-tools/23.0.2/zipalign' '-v' '4' '/var/folders/rl/mgs659qn063fnt_df5nbtq3c0000gn/T/tmp0T3QSU' '/var/folders/rl/mgs659qn063fnt_df5nbtq3c0000gn/T/tmpE1pifJ'
2020-01-22 09:23:10,346 [  DEBUG] Failed to run: /Users/leifullman/Library/Android/sdk/build-tools/23.0.2/zipalign -v 4 /var/folders/rl/mgs659qn063fnt_df5nbtq3c0000gn/T/tmp0T3QSU /var/folders/rl/mgs659qn063fnt_df5nbtq3c0000gn/T/tmpE1pifJ
2020-01-22 09:23:10,350 [  ERROR] Something went wrong that we didn't expect:
2020-01-22 09:23:10,350 [  ERROR] [Errno 86] Bad CPU type in executable
2020-01-22 09:23:10,350 [  DEBUG] Traceback (most recent call last):
  File "/Users/leifullman/Library/Trigger Toolkit/build-tools/forge/", line 106, in run
    result = self._target(*self._args, **self._kwargs)
  File "/Users/leifullman/Library/Trigger Toolkit/build-tools/forge/", line 498, in package
  File "/Users/leifullman/git/kidreportsllc/angular-legacy/.template/generate_dynamic/", line 225, in package_app
  File "/Users/leifullman/git/kidreportsllc/angular-legacy/.template/generate_dynamic/", line 347, in run
    self._call_with_params(task_method, task_args)
  File "/Users/leifullman/git/kidreportsllc/angular-legacy/.template/generate_dynamic/", line 306, in _call_with_params
    return method(self, *params)
  File "/Users/leifullman/git/kidreportsllc/angular-legacy/.template/generate_dynamic/", line 755, in package_android
    create_apk(build, zipf_name, interactive=False)
  File "/Users/leifullman/git/kidreportsllc/angular-legacy/.template/generate_dynamic/", line 598, in create_apk
    _align_apk(path_info, stage2, output_filename)
  File "/Users/leifullman/git/kidreportsllc/angular-legacy/.template/generate_dynamic/", line 472, in _align_apk
  File "/Users/leifullman/git/kidreportsllc/angular-legacy/.template/generate_dynamic/module_dynamic/", line 357, in run_shell
    raise state.error
OSError: [Errno 86] Bad CPU type in executable

Gnnf… okay, I think I’ve tracked it down:

It looks like we rely on the local Android SDK distribution for the “zipalign” binary.

What’s happening is that we’re picking up an ancient version 23.0.2 of the Android SDK build tools on your machine which doesn’t have 64 bit support:

2020-01-22 09:23:10,346 [DEBUG] Failed to run: /Users/leifullman/Library/Android/sdk/build-tools/23.0.2/zipalign -v 4 

We should probably be shipping zipalign with Forge rather than using the local Android distribution but what you can try in the meantime is:

  1. Check if you have versions newer than 23.0.2 in /Users/leifullman/Library/Android/sdk/build-tools/

  2. If you do, try to move all the older versions into a temporary folder until Forge hopefully picks up a version that has 64 bit support. (We’re currently using Android build tools version 29.0.2 on the backend.)

  3. If you don’t have a version with 64 bit support, you’ll need to update your Android SDK - if memory serves it goes something like this:

    <path to android sdk>/tools/bin/sdkmanager "platforms;android-29" "build-tools;29.0.2"

We’ll also update the platform to fix this from our side in the next Forge release.

All the best,