In android studio, when trying to “run” a project created by “ionic cap build android”, I received the following error:
Capacitor.build.gradle failed.
Could not find method android() for arguments [capacitor_build_5inrsddqrcw9wy0$_run_closure1@66f27ce8] on root project ‘app’ of type org.gradle.api.Project.
When I tried to “debug” the project, I got some message like:
The target JRE version 11.0.10 doesn’t match the project jdk…
When I ran “ionic capacitor run android”, I received error message:
[capacitor] update android in 408.55ms
[capacitor] 2021-10-02T10:34:44.415Z capacitor:android:run Invoking ./gradlew with args: [ ‘assembleDebug’ ]
[capacitor] Running Gradle build - failed!
[capacitor] [error] ERR_SUBPROCESS_COMMAND_NOT_FOUND
[ERROR] An error occurred while running subprocess capacitor.
capacitor run android --target xxxxxx exited with exit code 1.
Re-running this command with the --verbose flag may provide more
information.
ionic:utils-process onBeforeExit handler: ‘process.exit’ received +0ms
ionic:utils-process onBeforeExit handler: running 2 functions +0ms
ionic:utils-process processExit: exiting (exit code: 1) +54ms
My ionic info output:
Ionic:
Ionic CLI : 6.17.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.8.1
@angular-devkit/build-angular : 12.1.4
@angular-devkit/schematics : 12.1.4
@angular/cli : 12.1.4
@ionic/angular-toolkit : 4.0.0
Capacitor:
Capacitor CLI : 3.2.4
@capacitor/android : 3.2.4
@capacitor/core : 3.2.4
@capacitor/ios : 3.2.4
Utility:
cordova-res : 0.15.3
native-run : 1.4.1
System:
NodeJS : v14.18.0 (/usr/local/bin/node)
npm : 6.14.15
OS : macOS Big Sur
Any help would be much appreciated.