How to fix this build error for capacitor in android studio

Viewed 4436

Im trying to compile my first ionic app with capacitor for android. Gradle successfuly builds it but when I try to run it on android studio i get this error:

 Failed to query the value of task ':capacitor-android:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.

Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, C:\jsprojects\ajoopay2\node_modules@capacitor\android\capacitor\build\generated\ap_generated_sources\debug\out))) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@482d6451) before task ':capacitor-android:compileDebugJavaWithJavac' has completed is not supported

I have no idea what to do and ive spent hours trying to correct this please help me

2 Answers

sometimes this happens when yours

distributionUrl=https://services.gradle.org/distributions/gradle-x-x-x.zip

incompatible with yours project build.gradle

classpath 'com.android.tools.build:gradle:y.y.y'

Good luck resolving this, android studio will not give you any clue about it smilyface

I found a fix. I just had to downgrade my version of gradle from 7 to 5. Next time im installing android studio ill make sure to use the gradle version suggested

Related