Task 'bundle' not found in root project 'android'

i want to build ionic project to .aab file but get error like this

I issue a command like this

1. npm install @capacitor/android
2. ionic capacitor add android
3. ionic capacitor sync android
4. cd anroid/
5. gradlew bundle

and then an error like this comes out

FAILURE: Build failed with an exception.

  • What went wrong:
    Task ‘bundle’ not found in root project ‘android’.

  • Try:
    Run gradlew tasks to get a list of available tasks. 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.

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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See Command-Line Interface

my ionic version is 5.4.16

is there something wrong, let me know if there is a way out thank you

This question seems like a better fit for the Capacitor forum than the React forum.

That said, you need to build with Android Studio, not gradlew.

1 Like

run npx cap open android, this will open android studio, go to build and select the build method you want.

run the –stacktrace option it will give us a more into depth reason as to why its refusing to build but try the first option on top