I have been building ionic for android and ios successfully until suddenly today something is wrong.
I deleted android directory:
rm -rf android
I built my ionic project with no problems:
ionic build --prod --release
ionic cap add android, and get this output:
$ ionic cap add android > npm i -E @capacitor/android@latest removed 1 package, and audited 1728 packages in 4s 1 package is looking for funding run `npm fund` for details 63 vulnerabilities (3 low, 50 moderate, 8 high, 2 critical) To address issues that do not require attention, run: npm audit fix To address all issues (including breaking changes), run: npm audit fix --force Run `npm audit` for details. > capacitor add android [capacitor] ✔ Adding native android project in android in 31.55ms [capacitor] Error running gradle sync [capacitor] FAILURE: Build failed with an exception. [capacitor] [capacitor] * What went wrong: [capacitor] Executing Gradle tasks as part of an undefined build is not supported. Make sure that you are executing Gradle from a folder within your Gradle project. Your project should have a 'settings.gradle(.kts)' file in the root folder. [capacitor] [capacitor] * Try: [capacitor] 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. [capacitor] [capacitor] * Get more help at https://help.gradle.org [capacitor] [capacitor] BUILD FAILED in 550ms [capacitor] [capacitor] Unable to infer default Android SDK settings. This is fine, just run npx cap open android and import and sync gradle manually
I cannot figure out what is suddenly wrong here…
Here is my info:
$ ionic info Ionic: Ionic CLI : 6.16.1 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 5.5.1 @angular-devkit/build-angular : 0.1000.8 @angular-devkit/schematics : 10.0.8 @angular/cli : 10.0.8 @ionic/angular-toolkit : 2.3.3 Capacitor: Capacitor CLI : 3.0.0 @capacitor/android : 3.0.0 @capacitor/core : 3.0.0 @capacitor/ios : 3.0.0 Cordova: Cordova CLI : 10.0.0 Cordova Platforms : none Cordova Plugins : no whitelisted plugins (1 plugins total) Utility: cordova-res (update available: 0.15.3) : 0.15.2 native-run : 1.3.1 System: Android SDK Tools : 26.1.1 (/Users/vtn2/Library/Android/sdk) NodeJS : v12.19.0 (/usr/local/bin/node) npm : 7.5.2 OS : macOS Big Sur Xcode : Xcode 12.5 Build version 12E262
Is this possibly a Capacitor v3 problem?
(Note that when I just ignore this error and go on to try to build the project in Android Studio, i get “This version of the Android Support plugin for IntelliJ IDEA cannot open this project, please retry with version 4.2 or newer.” Not sure that is related or not…
This is frustrating! I’m so close to being done with this project, and now I can’t build it!