From 4143969cf058188d8abdd0b5ede044a2d2637e4b Mon Sep 17 00:00:00 2001 From: Shashank Kumar Date: Thu, 21 Mar 2024 04:52:29 +0530 Subject: [PATCH] updated_building_robolectric --- building-robolectric.md | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/building-robolectric.md b/building-robolectric.md index fbc6a0185..3d1d00865 100644 --- a/building-robolectric.md +++ b/building-robolectric.md @@ -9,7 +9,7 @@ toc: true This page describes how to set up a development environment to build Robolectric in the supported OSs (Linux, Mac, Windows). -JDK 11 is currently recommended to build Robolectric. Newer versions of the JDK (e.g. 17) will likely work, but may contain some rough edges. +JDK 17 is currently required to build Robolectric. Newer versions of the JDK (e.g. 21) will likely work, but may contain some rough edges. ## Installing Android SDK Tools @@ -24,10 +24,23 @@ require the Android build tools to be installed and specific SDK versions to be This section contains instructions for an Ubuntu Linux system. Other Linux systems will have different package management commands. +**Note:** `openjdk-17-jdk` may need to be installed separately, as it's not accessible in all Ubuntu versions. Here's how you can install it: + +There are some tools that are used by Robolectric to download code, build code: + +1. git. +2. OpenJDK 17. + +If you're using Ubuntu 22.04+, you can run following commands to install these tools: + +``` +sudo apt install git openjdk-17-jdk +``` + +If you're using other Ubuntu or Linux variants you can search to find the proper approaches to install these tools. +Proceed with the rest of the Robolectric setup: ``` -# Install prerequisites -sudo apt-get update -sudo apt-get install git default-jdk openjdk-11-jdk make +sudo apt-get install git make git clone https://github.com/robolectric/robolectric.git cd robolectric ./gradlew clean assemble @@ -40,7 +53,7 @@ cd robolectric In order to get the C/C++ toolchain, you will need to install the XCode command line tools. To do this it is usually as simple as opening a terminal and running `xcode-select --install`. -### Install JDK 11 +## Install JDK 17 By default Mac does not come with a JDK. It is recommended to use [Azul](https://www.azul.com/downloads/?package=jdk), as they support the M1 architecture. @@ -58,9 +71,9 @@ cd robolectric ## Windows -### Install JDK 11 +### Install JDK 17 -By default Windows does not come with a JDK. It is recommended to install [Adoptium Temurin 11](https://adoptium.net/?variant=openjdk11&jvmVariant=hotspot). +By default Windows does not come with a JDK. It is recommended to install the 64 bit version of [Adoptium Temurin 17](https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot). ### Install msys2 64 bit @@ -76,6 +89,6 @@ pacman -Sy base-devel mingw-w64-x86_64-toolchain # Install the ming-w64-x86_64 p pacman -Sy git # Install git git clone https://github.com/robolectric/robolectric.git export ANDROID_SDK_ROOT=/c/Users/$USER/AppData/Local/Android/Sdk -export JAVA_HOME=/c/Program\ Files/Eclipse\ Adoptium/jdk-11.0.14.101-hotspot # Will likely be a different version on your machine +export JAVA_HOME=/c/Program\ Files/Eclipse\ Adoptium/jdk-17.0.10.7-hotspot # Will likely be a different version on your machine ./gradlew clean assemble ```