Skip to content

Commit 7ce8693

Browse files
chore: Setup Environment failing to install Java on Win ARM-64 (#5060)
Bump to Java 21
1 parent 1de31a9 commit 7ce8693

5 files changed

Lines changed: 20 additions & 28 deletions

File tree

.github/actions/buildnative/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ runs:
99
shell: bash
1010
run: |
1111
if [[ "$RUNNER_ARCH" == "ARM64" ]]; then
12-
echo "JAVA_HOME_11=$JAVA_HOME_11_ARM64" >> $GITHUB_ENV
12+
echo "JAVA_HOME_21=$JAVA_HOME_21_ARM64" >> $GITHUB_ENV
1313
else
14-
echo "JAVA_HOME_11=$JAVA_HOME_11_X64" >> $GITHUB_ENV
14+
echo "JAVA_HOME_21=$JAVA_HOME_21_X64" >> $GITHUB_ENV
1515
fi
1616
1717
- uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0

.github/actions/environment/action.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ runs:
5050
shell: bash
5151
run: sudo xcode-select --switch /Applications/Xcode_26.2.app
5252

53-
# Java 17 is needed for Android SDK setup step
54-
- name: Install Java 17
53+
# Java 21 is needed by .NET Android
54+
- name: Install Java 21
5555
if: ${{ !matrix.container }}
5656
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
5757
with:
58-
distribution: ${{ runner.os == 'Windows' && runner.arch == 'ARM64' && 'microsoft' || 'temurin' }}
59-
java-version: '17'
58+
distribution: temurin
59+
java-version: '21'
6060

6161
- name: Setup Android SDK
6262
if: ${{ !matrix.container }}
@@ -66,14 +66,6 @@ runs:
6666
packages: platform-tools platforms;android-35 platforms;android-36 build-tools;36.0.0
6767
log-accepted-android-sdk-licenses: false
6868

69-
# Java 11 is needed by .NET Android
70-
- name: Install Java 11
71-
if: ${{ !matrix.container }}
72-
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
73-
with:
74-
distribution: ${{ runner.os == 'Windows' && runner.arch == 'ARM64' && 'microsoft' || 'temurin' }}
75-
java-version: '11'
76-
7769
- name: Install Mono (macOS)
7870
if: runner.os == 'macOS'
7971
shell: bash

.github/workflows/device-tests-android.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ jobs:
159159
- name: Setup Environment
160160
uses: ./.github/actions/environment
161161

162-
- name: Select Java 17
162+
- name: Select Java 21
163163
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
164164
with:
165-
distribution: ${{ runner.os == 'Windows' && runner.arch == 'ARM64' && 'microsoft' || 'temurin' }}
166-
java-version: '17'
165+
distribution: temurin
166+
java-version: '21'
167167

168168
- name: Checkout github-workflows
169169
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
@echo off
22
setlocal
33

4-
rem this should point at JDK 11 (required for Android)
5-
if "%JAVA_HOME_11%" == "" set JAVA_HOME_11=C:\Program Files\Microsoft\jdk-11.0.15.10-hotspot
4+
rem this should point at JDK 21 (required for Android)
5+
if "%JAVA_HOME_21%" == "" set JAVA_HOME_21=C:\Program Files\Eclipse Adoptium\jdk-21
66

77
echo Starting Java Build
8-
echo Using Java SDK at %JAVA_HOME_11%
8+
echo Using Java SDK at %JAVA_HOME_21%
99
pushd %~dp0
1010

1111
rem clear and recreate the output directories
@@ -15,11 +15,11 @@ mkdir obj
1515
mkdir bin
1616

1717
rem compile the Java file(s)
18-
"%JAVA_HOME_11%\bin\javac" -verbose -d ./obj *.java
18+
"%JAVA_HOME_21%\bin\javac" -verbose -d ./obj *.java
1919

2020
rem build the Jar
2121
cd obj
22-
"%JAVA_HOME_11%\bin\jar" -cvf ..\bin\sentry-android-supplemental.jar *
22+
"%JAVA_HOME_21%\bin\jar" -cvf ..\bin\sentry-android-supplemental.jar *
2323

2424
popd
2525
echo Java Build Complete
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/bin/bash
22

3-
# this should point at JDK 11 (required for Android)
4-
if [ -z "${JAVA_HOME_11}" ]; then
5-
echo "Error: 'JAVA_HOME_11' is not set. Please set 'JAVA_HOME_11' to the path of JDK 11 (required for Android)." >&2
3+
# this should point at JDK 21 (required for Android)
4+
if [ -z "${JAVA_HOME_21}" ]; then
5+
echo "Error: 'JAVA_HOME_21' is not set. Please set 'JAVA_HOME_21' to the path of JDK 21 (required for Android)." >&2
66
exit 1
77
fi
88

99
echo "Starting Java Build"
10-
echo "Using Java SDK at $JAVA_HOME_11"
10+
echo "Using Java SDK at $JAVA_HOME_21"
1111
pushd "$(dirname "$0")" > /dev/null
1212

1313
# create the output directories if they don't exist
@@ -18,11 +18,11 @@ mkdir -p bin
1818
find obj bin -mindepth 1 -delete
1919

2020
# compile the Java file(s)
21-
"$JAVA_HOME_11/bin/javac" -verbose -d ./obj *.java
21+
"$JAVA_HOME_21/bin/javac" -verbose -d ./obj *.java
2222

2323
# build the Jar
2424
cd obj
25-
"$JAVA_HOME_11/bin/jar" -cvf ../bin/sentry-android-supplemental.jar *
25+
"$JAVA_HOME_21/bin/jar" -cvf ../bin/sentry-android-supplemental.jar *
2626

2727
popd > /dev/null
2828
echo "Java Build Complete"

0 commit comments

Comments
 (0)