Possibility to run JDK10 with XCode10.1 image

Apple Store forces soon (starting from March 2019) build stuff with XCode10.1. Problem is that such Travis image comes with JDK11 and Android won’t support Java 11. Because I have React Native application, it make sense to build and deploy both at the same process. But I haven’t find any working solutions to get Android succesfully builded, (probably don’t have enough skills to do something to get rid of that Java 11 and use 10 instead which is version you can get Android working with little tricks).

So question: Is there any way to get Java 10 installed to that xcode10.1 image? Since it’s High Sierra and Java 10 is default. And if yes, how that happens? It would be very bad scenario if we can’t handle build & deploy process with same image in future.

Got that problem solved. Tried adoptOpenJDK stuff earlier but always had some problems which failed build. But then I try to install java8 straight from casks before_install, and that do the trick. In case somebody else wondering how to got Android builds succesfully with this image and find this topic, there is some quick instructions. You can for example do some script which you run before build script:

# Update packages
brew update

# Install Android SDK and handle license
# (there is lots of ways to get licenses correctly so this is just mine style)
brew cask install android-sdk
export ANDROID_HOME=/usr/local/share/android-sdk
mkdir -p "$ANDROID_HOME/licenses"
echo -e "\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license"

# Install JDK8 because Travis image have JDK11
# Java 11 is not supported by Android SDK at all
brew cask install homebrew/cask-versions/java8
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)

# This is for getting newest build tool licences accepted, for example Android 9 (SDK 28)
yes | sdkmanager --licenses && yes | sdkmanager --update

... next you can start your Android building things way you wanted ...
1 Like