Android Build Failing - Execution failed for task ':app:compileDebugJavaWithJavac'


I’m very new to all of this (i. e. ionic framework, app development & u could say computers in general).
I have been trying to develop an app with ionic frame work to export to iOS & android.
Trying the web build it works well and i get the expected result (i. e. the same as i get w/ ionic serve).
I am now trying to get my android build running.
It has been 2 days now and I am stuck because of this error :slight_smile:
“Execution failed for task ‘:app:compileDebugJavaWithJavac’.” when running the command : “ionic cordova run android”.

I should probably mention that i installed for the first time ever on my machine yesterday :

  • gradle
  • android studio
  • android sdk
  • java jdk
    which as a result should all be up to date.

I have been setting my JAVA_HOME & ANDROID_HOME according to instructions i found on stack-overflow topics and the parameters seem right (i. e. i point to the corresponding folders on my hdd).

Any help would be much appreciated. I would def buy you a beer if you can get me to solve this :sweat_smile:


That means java is failing to compile, so would help if you provide the whole error and not just a small part of it.

1 Like

I’m getting the same error and struggling to resolve it.
Here’s what I see about it on console :
[capacitor] * What went wrong:
[capacitor] Execution failed for task ‘:capacitor-android:compileDebugJavaWithJavac’.
[capacitor] > Failed to query the value of task ‘:capacitor-android:compileDebugJavaWithJavac’ property ‘options.generatedSourceOutputDirectory’.
[capacitor] > Querying the mapped value of map( property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, C:\CODELAB\POCs\ionicFireship\node_modules@capacitor\android\capacitor\build\generated\ap_generated_sources\debug\out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@7613d067) before task ‘:capacitor-android:compileDebugJavaWithJavac’ has completed is not supported

What would be the solution for this, please.