Skip to content

Instantly share code, notes, and snippets.

@jeremyclee
Created May 20, 2018 04:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jeremyclee/15915960ab1c72156313bde4d493b297 to your computer and use it in GitHub Desktop.
Save jeremyclee/15915960ab1c72156313bde4d493b297 to your computer and use it in GitHub Desktop.
Pre-Build script for MS AppCenter to resolve React-Native/NDK R17 compile error
#!/usr/bin/env bash
# Reverts the Android NDK version to r16b from r17 to resolve a react native compile issue:
# https://github.com/facebook/react-native/issues/19321
# https://github.com/android-ndk/ndk/issues/700
set -ex
# set env vars
export ANDROID_NDK_VERSION='r16b'
# create a temp working directory
mkdir ./android-ndk-tmp
cd ./android-ndk-tmp
# download ndk
wget -q https://dl.google.com/android/repository/android-ndk-$ANDROID_NDK_VERSION-linux-x86_64.zip
# uncompress
unzip -o android-ndk-$ANDROID_NDK_VERSION-linux-x86_64.zip
# move to its final location
mv ./android-ndk-$ANDROID_NDK_VERSION $ANDROID_HOME/ndk-bundle
# remove temp dir
cd ..
rm -rf ./android-ndk-tmp
# add to PATH
export PATH=${PATH}:$ANDROID_HOME/ndk-bundle
@matthiaswenz
Copy link

Hi there, Mat from App Center Build team here - thanks for creating this gist. I'm not entirely sure it would work though, since it downloads the Linux version of the NDK, our build VMs are Macs - so it would need to download the "darwin" version.
Also, we are working on a fix to this - would love to chat if it works for you.

@agonbina
Copy link

agonbina commented May 23, 2018

@ranterle this did not fix the issue for me as the script fails to execute at all. It was suggested to try by the appcenter support.

@ionut-movila
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment