skip checkup passes, but building projects fails with Gradle run error
Discussed in https://github.com/skiptools/skip/discussions/74
Originally posted by Wheels00 December 28, 2023 skip checkup --double-check passes just fine (screenshot below)
I have downloaded the SkipWeather example, and I am trying to run it in both simulators. Build fails with this error:
Any suggestions?
[Update: Same error on new projects built with skip init]
The only project I can build and run is: https://github.com/DominatorVbN/SkipTour
From the report navigator:
note: running gradle build with: /Users/markbrown/Library/Developer/Xcode/DerivedData/RosterLobster-gqwgtaiitaonbweznquvwfrjjamv/Build/Products/../../SourcePackages/artifacts/skip/skip/skip.artifactbundle/macos/skip gradle -p /Users/markbrown/Documents/RosterLobster/roster-lobster/Darwin/../Android launchDebug
Error: Gradle run error: Optional(SkipDriveExternal.ProcessResult.ExitStatus.terminated(code: 1))
GRADLE> Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
GRADLE> Skip module :SkipUI added to project: /Users/markbrown/Library/Developer/Xcode/DerivedData/RosterLobster-gqwgtaiitaonbweznquvwfrjjamv/Build/Products/Debug/../../../SourcePackages/plugins/roster-lobster.output/RosterLobster/skipstone/SkipUI
GRADLE> Skip module :SkipUnit added to project: /Users/markbrown/Library/Developer/Xcode/DerivedData/RosterLobster-gqwgtaiitaonbweznquvwfrjjamv/Build/Products/Debug/../../../SourcePackages/plugins/roster-lobster.output/RosterLobster/skipstone/SkipUnit
GRADLE> Skip module :SkipModel added to project: /Users/markbrown/Library/Developer/Xcode/DerivedData/RosterLobster-gqwgtaiitaonbweznquvwfrjjamv/Build/Products/Debug/../../../SourcePackages/plugins/roster-lobster.output/RosterLobster/skipstone/SkipModel
GRADLE> Skip module :RosterLobster added to project: /Users/markbrown/Library/Developer/Xcode/DerivedData/RosterLobster-gqwgtaiitaonbweznquvwfrjjamv/Build/Products/Debug/../../../SourcePackages/plugins/roster-lobster.output/RosterLobster/skipstone/RosterLobster
GRADLE> Skip module :SkipFoundation added to project: /Users/markbrown/Library/Developer/Xcode/DerivedData/RosterLobster-gqwgtaiitaonbweznquvwfrjjamv/Build/Products/Debug/../../../SourcePackages/plugins/roster-lobster.output/RosterLobster/skipstone/SkipFoundation
GRADLE> Skip module :SkipLib added to project: /Users/markbrown/Library/Developer/Xcode/DerivedData/RosterLobster-gqwgtaiitaonbweznquvwfrjjamv/Build/Products/Debug/../../../SourcePackages/plugins/roster-lobster.output/RosterLobster/skipstone/SkipLib
GRADLE>
GRADLE> FAILURE: Build failed with an exception.
GRADLE>
GRADLE> * What went wrong:
GRADLE> Could not determine the dependencies of task ':app:packageDebug'.
GRADLE> > Could not create task ':app:compileDebugJavaWithJavac'.
GRADLE> > Failed to calculate the value of task ':app:compileDebugJavaWithJavac' property 'javaCompiler'.
GRADLE> > No matching toolchains found for requested specification: {languageVersion=17, vendor=any, implementation=vendor-specific} for MAC_OS on aarch64.
GRADLE> > No locally installed toolchains match and toolchain download repositories have not been configured.
GRADLE>
GRADLE> * Try:
GRADLE> > Learn more about toolchain auto-detection at https://docs.gradle.org/8.5/userguide/toolchains.html#sec:auto_detection.
GRADLE> > Learn more about toolchain repositories at https://docs.gradle.org/8.5/userguide/toolchains.html#sub:download_repositories.
GRADLE> > Run with --stacktrace option to get the stack trace.
GRADLE> > Run with --info or --debug option to get more log output.
GRADLE> > Run with --scan to get full insights.
GRADLE> > Get more help at https://help.gradle.org.
GRADLE>
GRADLE> BUILD FAILED in 12s
note: Gradle FAILED:
error: Gradle run error: Optional(SkipDriveExternal.ProcessResult.ExitStatus.terminated(code: 1))
I notice you are running skip 0.7.38. Can you do brew upgrade skip to 0.7.39 and try again with skip init --open-xcode --test --appid=com.example.App example-app ExampleApp and let us know the output?
From the error you post, this does look like an OpenJDK 17/21 issue. The relevant part of the build error is:
GRADLE> > Failed to calculate the value of task ':app:compileDebugJavaWithJavac' property 'javaCompiler'.
GRADLE> > No matching toolchains found for requested specification: {languageVersion=17, vendor=any, implementation=vendor-specific} for MAC_OS on aarch64.
GRADLE> > No locally installed toolchains match and toolchain download repositories have not been configured.
Can you post the output of the command ls -la /opt/homebrew/opt/openjdk*? I expect it to look something like:
% ls -la /opt/homebrew/opt/openjdk*
lrwxr-xr-x 1 marc admin 24 Dec 6 19:29 /opt/homebrew/opt/openjdk -> ../Cellar/openjdk/21.0.1
lrwxr-xr-x 1 marc admin 27 Dec 6 19:31 /opt/homebrew/opt/openjdk@17 -> ../Cellar/openjdk@17/17.0.9
lrwxr-xr-x 1 marc admin 24 Dec 6 19:29 /opt/homebrew/opt/openjdk@21 -> ../Cellar/openjdk/21.0.1
If openjdk@17 is not listed there, can you install it with brew install openjdk@17 and try again?
As a last-ditch effort, you can always override the JAVA_HOME yourself in the Run skip gradle build phase for the project, which should give gradle enough of a hint to proceed.
FTR, once Gradle 8.5 stabilizes, we intend to have Skip use OpenJDK 21, which will hopefully squash these kinds of problems once and for all.
@marcprux thanks so much for the help.
As you suggested, I first ran brew upgrade skip. Output:
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 3 taps (skiptools/skip, homebrew/core and homebrew/cask).
==> New Formulae
cargo-llvm-cov pivit wasmedge
==> New Casks
lightburn opencat
You have 47 outdated formulae and 1 outdated cask installed.
==> Upgrading 1 outdated package:
skiptools/skip/skip 0.7.38 -> 0.7.39
==> Upgrading skip
==> Caveats
Installing skip means you have AGREED to the license at:
https://skip.tools/eula
==> Downloading https://source.skip.tools/skip/releases/download/0.7.39/skip.zip
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be
########################################################################################## 100.0%
All formula dependencies satisfied.
==> Unlinking Binary '/opt/homebrew/bin/skip'
==> Linking Binary 'skip' to '/opt/homebrew/bin/skip'
==> Purging files for version 0.7.38 of Cask skip
🍺 skip was successfully upgraded!
Next I ran skip init --open-xcode --test --appid=com.example.App example-app ExampleApp
Initializing Skip library example-app
[✓] Resolve dependencies (24.4s)
[✓] Build example-app (14.3s)
[✓] Test Swift (7.93s)
[✓] Test Kotlin (65.3s)
[✓] Check Swift Package (0.74s)
[✓] Created module ExampleApp in /Users/markbrown/Desktop/temp/example-app
[✓] Opening Xcode project (0.97s)
In xcode i clicked run:
Showing Recent Messages
Error: Gradle run error: Optional(SkipDriveExternal.ProcessResult.ExitStatus.terminated(code: 1))
GRADLE> Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
GRADLE> Skip module :SkipUI added to project: /Users/markbrown/Library/Developer/Xcode/DerivedData/ExampleApp-fbosnmxdmwlfkgegeabtkqnxrydi/Build/Products/Debug/../../../SourcePackages/plugins/example-app.output/ExampleApp/skipstone/SkipUI
GRADLE> Skip module :SkipUnit added to project: /Users/markbrown/Library/Developer/Xcode/DerivedData/ExampleApp-fbosnmxdmwlfkgegeabtkqnxrydi/Build/Products/Debug/../../../SourcePackages/plugins/example-app.output/ExampleApp/skipstone/SkipUnit
GRADLE> Skip module :SkipModel added to project: /Users/markbrown/Library/Developer/Xcode/DerivedData/ExampleApp-fbosnmxdmwlfkgegeabtkqnxrydi/Build/Products/Debug/../../../SourcePackages/plugins/example-app.output/ExampleApp/skipstone/SkipModel
GRADLE> Skip module :SkipFoundation added to project: /Users/markbrown/Library/Developer/Xcode/DerivedData/ExampleApp-fbosnmxdmwlfkgegeabtkqnxrydi/Build/Products/Debug/../../../SourcePackages/plugins/example-app.output/ExampleApp/skipstone/SkipFoundation
GRADLE> Skip module :ExampleApp added to project: /Users/markbrown/Library/Developer/Xcode/DerivedData/ExampleApp-fbosnmxdmwlfkgegeabtkqnxrydi/Build/Products/Debug/../../../SourcePackages/plugins/example-app.output/ExampleApp/skipstone/ExampleApp
GRADLE> Skip module :SkipLib added to project: /Users/markbrown/Library/Developer/Xcode/DerivedData/ExampleApp-fbosnmxdmwlfkgegeabtkqnxrydi/Build/Products/Debug/../../../SourcePackages/plugins/example-app.output/ExampleApp/skipstone/SkipLib
GRADLE>
GRADLE> FAILURE: Build failed with an exception.
GRADLE>
GRADLE> * What went wrong:
GRADLE> Could not determine the dependencies of task ':app:packageDebug'.
GRADLE> > Could not create task ':app:compileDebugJavaWithJavac'.
GRADLE> > Failed to calculate the value of task ':app:compileDebugJavaWithJavac' property 'javaCompiler'.
GRADLE> > No matching toolchains found for requested specification: {languageVersion=17, vendor=any, implementation=vendor-specific} for MAC_OS on aarch64.
GRADLE> > No locally installed toolchains match and toolchain download repositories have not been configured.
GRADLE>
GRADLE> * Try:
GRADLE> > Learn more about toolchain auto-detection at https://docs.gradle.org/8.5/userguide/toolchains.html#sec:auto_detection.
GRADLE> > Learn more about toolchain repositories at https://docs.gradle.org/8.5/userguide/toolchains.html#sub:download_repositories.
GRADLE> > Run with --stacktrace option to get the stack trace.
GRADLE> > Run with --info or --debug option to get more log output.
GRADLE> > Run with --scan to get full insights.
GRADLE> > Get more help at https://help.gradle.org.
GRADLE>
GRADLE> BUILD FAILED in 9s
running gradle build with: /Users/markbrown/Library/Developer/Xcode/DerivedData/ExampleApp-fbosnmxdmwlfkgegeabtkqnxrydi/Build/Products/../../SourcePackages/artifacts/skip/skip/skip.artifactbundle/macos/skip gradle -p /Users/markbrown/Desktop/temp/example-app/Darwin/../Android launchDebug
Gradle FAILED:
Gradle run error: Optional(SkipDriveExternal.ProcessResult.ExitStatus.terminated(code: 1))
Continuing with your advice, ls -la /opt/homebrew/opt/openjdk*:
lrwxr-xr-x 1 markbrown admin 24 24 Dec 20:23 /opt/homebrew/opt/openjdk -> ../Cellar/openjdk/21.0.1
lrwxr-xr-x 1 markbrown admin 27 24 Dec 20:22 /opt/homebrew/opt/openjdk@17 -> ../Cellar/openjdk@17/17.0.9
lrwxr-xr-x 1 markbrown admin 24 24 Dec 20:23 /opt/homebrew/opt/openjdk@21 -> ../Cellar/openjdk/21.0.1
openjdk@17 is listed, but i'll reinstall with brew reinstall openjdk@17 anyway :
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/17/manifests/17.0.9
Already downloaded: /Users/markbrown/Library/Caches/Homebrew/downloads/6274f55d293c4208920a5d52b3b06d4a9dedb0e7139b671f4f66fada2abbc486--openjdk@17-17.0.9.bottle_manifest.json
==> Fetching openjdk@17
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/17/blobs/sha256:e227f7f0fc589932708276bcc7953f5ce6aebaa062f7fdfe980cd48
######################################################################################################################### 100.0%
==> Reinstalling openjdk@17
==> Pouring [email protected]_sonoma.bottle.tar.gz
🍺 /opt/homebrew/Cellar/openjdk@17/17.0.9: 635 files, 304.9MB
==> Running `brew cleanup openjdk@17`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
No change. Still:
GRADLE> FAILURE: Build failed with an exception.
GRADLE>
GRADLE> * What went wrong:
GRADLE> Could not determine the dependencies of task ':app:packageDebug'.
GRADLE> > Could not create task ':app:compileDebugJavaWithJavac'.
GRADLE> > Failed to calculate the value of task ':app:compileDebugJavaWithJavac' property 'javaCompiler'.
GRADLE> > No matching toolchains found for requested specification: {languageVersion=17, vendor=any, implementation=vendor-specific} for MAC_OS on aarch64.
GRADLE> > No locally installed toolchains match and toolchain download repositories have not been configured.
I’m not quite sure how and where to set JAVA_HOME exactly, but I will try to find out and report back
I don’t know if this was right, but in build phases -> run skip gradle, I inserted the first line:
JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home
if [ "${SKIP_ZERO}" != "" ]; then
echo "note: skipping skip due to SKIP_ZERO"
exit 0
fi
if [ "${ENABLE_PREVIEWS}" == "YES" ]; then
echo "note: skipping skip due to ENABLE_PREVIEWS"
exit 0
fi
if [ "${ACTION}" = "install" ]; then
SKIP_ACTION="build"
else
SKIP_ACTION="${SKIP_ACTION:-launch}"
fi
PATH=${BUILD_ROOT}/Debug:${BUILD_ROOT}/../../SourcePackages/artifacts/skip/skip/skip.artifactbundle/macos:${PATH}:${HOMEBREW_PREFIX:-/opt/homebrew}/bin
echo "note: running gradle build with: $(which skip) gradle -p ${PWD}/../Android ${SKIP_ACTION:-launch}${CONFIGURATION:-Debug}"
skip gradle -p ../Android ${SKIP_ACTION:-launch}${CONFIGURATION:-Debug}
I did clean build folder a couple of times, but no change. I am not confident I correctly set JAVA_HOME though
I ran into the same issue.
you can check if the requested Gradle toolchain is installed by running
gradle -q javaToolchains
In my case I had no toolchain (SDK) for Java17 so I installed JDK 17.0.10 and it worked.
I ran into the same issue.
you can check if the requested Gradle toolchain is installed by running
gradle -q javaToolchainsIn my case I had no toolchain (SDK) for Java17 so I installed JDK 17.0.10 and it worked.
I was having the same erros and this solution worked for me. Thank you!