Skip to content

Commit

Permalink
updated_building_robolectric
Browse files Browse the repository at this point in the history
  • Loading branch information
shashankiitbhu committed Mar 20, 2024
1 parent 6722252 commit 4143969
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions building-robolectric.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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.

Expand All @@ -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

Expand All @@ -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
```

0 comments on commit 4143969

Please # to comment.