12
  1. i am trying to creating ionic build, but getting error, here is my step.
  2. ionic cordova platform remove android
  3. ionic cordova platform add android
  4. ionic cordova build android

while i run last command then got below Error.

FAILURE: Build failed with an exception.
  • Where: Script 'D:\Projects\corporatesolutionmobileapp\platforms\android\cordova-android -support-gradle-release\sancial-cordova-android-support-gradle-release.gradle' l ine: 11

  • What went wrong: A problem occurred evaluating script.

    Could not read script 'D:\Projects\corporatesolutionmobileapp\platforms\androi d\app\cordova-android-support-gradle-release\properties.gradle' as it does not e xist.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s [ERROR] An error occurred while running subprocess cordova.

    cordova build android exited with exit code 1.

    Re-running this command with the --verbose flag may provide more
    information.
Bhavin
  • 441
  • 1
  • 4
  • 17

7 Answers7

44

I was having a similar problem, running the command ionic capacitor run android I was getting androidmanifest.xml doesn't exist.

It was solved by running the command ionic capacitor update

JuanPabloAmador
  • 596
  • 1
  • 4
  • 6
11

Updating to the most recent version (v2.0.1) of cordova-android-support-gradle-release should resolve your issue:

ionic cordova platform rm android
ionic cordova plugin rm cordova-android-support-gradle-release
ionic cordova plugin add cordova-android-support-gradle-release@latest 
ionic cordova platform add android
ionic cordova build android
DaveAlden
  • 30,083
  • 11
  • 93
  • 155
5

I was getting this error while only using Capacitor which I thought was strange so I nuked the android path in my root folder and then npx cap add android again and the build worked after that

Aaron Jordan
  • 2,447
  • 2
  • 15
  • 13
5

Updating Capacitor did the trick for me:

npx cap update
Eclair4k
  • 51
  • 1
  • 3
0

This issue is mostly faced, when you add/remove a new plugin. So by just running cordova clean can resolve that issue.

Inside your CMD/Terminal:

C:\<project folder>\cordova clean
Masood
  • 1,545
  • 1
  • 19
  • 30
0
  It is related to M1 chipset of mac.

   % brew uninstall node
   % brew install nodenv 
   % echo 'export PATH=${PATH}:~/.nodenv/shims' >> ~/.zprofile 
   % nodenv install 17.7.2
   % nodenv global 17.7.2

   % npx cap run android
   ✔ Copying web assets from www to android/app/src/main/assets/public in 7.48ms
  ✔ Creating capacitor.config.json in android/app/src/main/assets in 745.25μs
  ✔ copy android in 12.87ms
  ✔ Updating Android plugins in 3.42ms
  [info] Found 3 Capacitor plugins for android:
   @capacitor/camera@1.3.1
   @capacitor/filesystem@1.1.0
   @capacitor/geolocation@1.3.1
  ✔ update android in 32.04ms
  ✔ Running Gradle build in 1.32s
  ✔ Deploying app-debug.apk to emulator-5554 in 1.88s


 ref https://github.com/ionic-team/capacitor/issues/5545
Brijmohan Karadia
  • 437
  • 1
  • 5
  • 10
-2

Solved:

  • Delete the Android Directory from your folder
  • Follow the steps mentioned in the ionic capacitor troubleshoot documentation at

https://capacitorjs.com/docs/android/troubleshooting#recreating-your-project

Rohan Patil
  • 175
  • 1
  • 4