How to fix this build error for capacitor in android studio
Asked Answered
B

2

8

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

Burning answered 29/4, 2021 at 10:7 Comment(4)
check this "#33405052"Kreg
Lol. Ive been to that page like 50 times, no helpBurning
any luck fixing this issue? @NobleEugeneDansby
Try downgrading gradle version @DansbyBurning
G
8

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

Gilgilba answered 26/8, 2021 at 14:21 Comment(0)
B
-4

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

Burning answered 29/4, 2021 at 12:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.