Open TWiStErRob opened 1 year ago
Same issue here.
Fortunately, my project had already migrated from JDK8 to JDK11, and simply removing the JDK8 reference from workflow solved the issue.
Here is an example of the change in my project.
I can only show you an excerpt, but you can see that I changed to set up JDK11 before calling actions/setup-android@2
.
diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml
index 403b46913..f5fd01c1f 100644
--- a/.github/actions/setup/action.yml
+++ b/.github/actions/setup/action.yml
@@ -8,7 +8,7 @@ runs:
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
- java-version: '8'
+ java-version: '11'
- uses: actions/cache@v3
with:
path: |
@@ -18,9 +18,5 @@ runs:
key: ${{ inputs.cache_key }}
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- - uses: actions/setup-java@v3
- with:
- distribution: 'adopt'
- java-version: '11'
- run: make publish-local
shell: bash
Yeah, I started upgrading my project from Java 8 to Java 19 too (not results yet, in progress), it should hide this problem. The weirdest thing is it being random.
Also follow https://issuetracker.google.com/issues/266618722 in case they update the docs and confirm my suspicion.
Sorry mates, took me a while.
I have no idea why it was sporadic, but this is JDK version issue. I am not sure about cmdline-tools 10.0, but current version 11.0 requires JDK 17.
setup-android action runs sdkmanager (part of cmdline-tools) as part of it's install process, this means that the action requires the same JDK version that is required by the cmdline-tools.
@TWiStErRob , @S64 , is it reasonable for me to expect y'all to just upgrade to JDK17 (or later) or is it necessary for us to make something work with JDK11?
Since AGP 8 requires JDK 17 too, this requirement is more relaxed from your side, unless projects use AGP pre-8 + latest Android SDK. This should cover "normal" use cases.
This pattern might help to run Gradle and Android SDK on latest JDK, but keep testing lower versions.
However, I for example have a Gradle plugin where I test compatibility and run older AGP/Gradle GitHub actions matrix where I need to use Java 11 (because old AGP/Gradle CANNOT run on Java 17). To work around this I use essentially following order: setup-java=17, setup-android, setup-java=${{ matrix.java }}, gradlew ...
. This works because I make sure to pre-install everything so there's no sdkmanager
calls during build.
Is it possible to specify a Java version internally akin to?
https://github.com/android-actions/setup-android/blob/9584f05408b63719e3464df8ac85bdbe58f88a64/action.yml#L6
This would allow setup-android
to use the right version, and the outer world could have whatever they desire or nothing at all.
Is it possible to specify a Java version internally akin to?
Few thousand lines of yaml later...
It would be possible to set up your own Java if this was implemented: https://github.com/actions/setup-java/issues/552
However the action would need to be wrapped in a using: composite
.
Hi, I started sporadically getting this error yesteday:
It happens randomly. I have a big matrix 38 jobs, 23 of them use Java 8, and 2-3 of them randomly chosen of the 23 fail with the above.
My guess is that
cmdline-tools:latest
was just released with a requirement on Java 11. And thissetup-android
action is just showing the problem, not causing it. Reported here anyway just in case you know anything, and others are looking at the same problem.Example fail: https://github.com/TWiStErRob/net.twisterrob.gradle/actions/runs/3939418181/jobs/6862851517 (Note that it is Attempt 2, because the original Attempt 1 execution didn't fail, and because it's on master nothing has changed since Attempt 1 in my code.)
The only other reference to this I found: https://ask.csdn.net/questions/7878632