Execution failed for task ':capacitor-android:compileDebugJavaWithJavac'. > error: invalid source release: 21

the interesting thing is that i never installed java version 21, but i use 17, with which i have created apk before, what is going on?

Welcome to Gradle 8.11.1!

Here are the highlights of this release:

  • Parallel load and store for Configuration Cache
  • Java compilation errors at the end of the build output
  • Consolidated report for warnings and deprecations

For more details see Gradle 8.11.1 Release Notes

Starting a Gradle Daemon (subsequent builds will be faster)

Configure project :app
WARNING: Using flatDir should be avoided because it doesn’t support any meta-data formats.

Configure project :capacitor-cordova-android-plugins
WARNING: Using flatDir should be avoided because it doesn’t support any meta-data formats.
Errors during XML parse:
Additionally, the fallback loader failed to parse the XML.
Checking the license for package Android SDK Platform 35 in /opt/android-sdk/licenses
License for package Android SDK Platform 35 accepted.
Preparing “Install Android SDK Platform 35 (revision 2)”.
“Install Android SDK Platform 35 (revision 2)” ready.
Installing Android SDK Platform 35 in /opt/android-sdk/platforms/android-35
“Install Android SDK Platform 35 (revision 2)” complete.
“Install Android SDK Platform 35 (revision 2)” finished.

Task :app:preBuild UP-TO-DATE
Task :app:preDebugBuild UP-TO-DATE
Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
Task :capacitor-android:preBuild UP-TO-DATE
Task :capacitor-android:preDebugBuild UP-TO-DATE
Task :app:javaPreCompileDebug
Task :capacitor-cordova-android-plugins:preBuild UP-TO-DATE
Task :capacitor-cordova-android-plugins:preDebugBuild UP-TO-DATE
Task :capacitor-cordova-android-plugins:writeDebugAarMetadata
Task :capacitor-android:writeDebugAarMetadata
Task :app:generateDebugResValues
Task :capacitor-android:generateDebugResValues
Task :app:checkDebugAarMetadata
Task :capacitor-android:generateDebugResources
Task :capacitor-android:packageDebugResources
Task :capacitor-cordova-android-plugins:generateDebugResValues
Task :capacitor-cordova-android-plugins:generateDebugResources
Task :capacitor-cordova-android-plugins:packageDebugResources
Task :app:mapDebugSourceSetPaths
Task :app:generateDebugResources
Task :app:packageDebugResources
Task :app:createDebugCompatibleScreenManifests
Task :app:extractDeepLinksDebug
Task :capacitor-android:extractDeepLinksDebug
Task :capacitor-cordova-android-plugins:extractDeepLinksDebug
Task :capacitor-cordova-android-plugins:processDebugManifest
Task :capacitor-android:processDebugManifest
Task :app:parseDebugLocalResources
Task :app:mergeDebugResources
Task :capacitor-android:compileDebugLibraryResources
Task :app:processDebugMainManifest
Task :app:processDebugManifest
Task :app:processDebugManifestForPackage
Task :capacitor-cordova-android-plugins:compileDebugLibraryResources
Task :capacitor-android:javaPreCompileDebug
Task :capacitor-cordova-android-plugins:javaPreCompileDebug
Task :capacitor-android:parseDebugLocalResources
Task :capacitor-cordova-android-plugins:parseDebugLocalResources
Task :app:mergeDebugShaders
Task :app:compileDebugShaders NO-SOURCE
Task :app:generateDebugAssets UP-TO-DATE
Task :capacitor-android:mergeDebugShaders
Task :capacitor-android:compileDebugShaders NO-SOURCE
Task :capacitor-cordova-android-plugins:generateDebugRFile
Task :capacitor-android:generateDebugRFile
Task :capacitor-cordova-android-plugins:compileDebugJavaWithJavac NO-SOURCE
Task :app:processDebugResources
Task :capacitor-android:compileDebugJavaWithJavac FAILED
[Incubating] Problems report is available at: file:///android/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:capacitor-android:compileDebugJavaWithJavac’.

error: invalid source release: 21

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

Are you using Capacitor 7?

We’ve got a beta running for that. I’ve just sent you instructions on how to use it.

Let us know if that takes care of your issue.

I also tried 6.2, but it tells me it requires 7.0.1. can you give me the link with the instructions to make it work with android 7.0.1?

You should have gotten an email by now, but here’s the content:

Good news! We’ve made updates to our Capacitor build process.

  1. Support added for Capacitor 7: You can now use Ionic’s latest version of Capacitor.

  2. Build stack updated: lots updates to tools, SDKs, operating systems, etc.: Everything is now on the latest version.

  3. The Capacitor sample has been updated to use Capacitor 7.

You shouldn’t notice any difference to how your jobs run or their output. To be certain of this, we’re running a limited time beta.

On the Upload screen, you will notice a new prompt: “Build using beta servers?”. It would be of great help to us and others if you could submit your job and let us know if it works OK.

As always, if you have suggestions how we can make VoltBuilder better, please let us know!

I just noticed you signed up to VoltBuilder using more than one email address, and that you submitted again under the new email.

I have enabled that email address as well - give it another try!