gradlew bundle not générating AAB file

Viewed 28

I'm currently upgrading a 2 years old android application from angular 8 to angular 14 and from ionic 4 to ionic 6.

Upgrade process both for Angular and ionic went well.

I have successfully build an APK for test and customer validating with ionic cordova build android --prod --release.

Next step, i try to build an AAB file for publishing against Play store with ./gradlew bundle command while being in the platforms/android directory.

but the command fail with this error:

FAILURE: Build failed with an exception.

* What went wrong:
Task 'bundle' is ambiguous in root project 'android'. Candidates are: 'bundleAppClassesDebug', 'bundleAppClassesDebugAndroidTest', 'bundleAppClassesDebugUnitTest', 'bundleAppClassesRelease', 'bundleAppClassesReleaseUnitTest', 'bundleDebug', 'bundleRelease'.

So i try running ./gradlew bundleRelease command and then i get this results:

> Configure project :CordovaLib
publishNonDefault is deprecated and has no effect anymore. All variants are now published.

> Configure project :app
+-----------------------------------------------------------------
| cordova-android-support-gradle-release: 27.+
+-----------------------------------------------------------------
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_azhwvifz60xcmt5zw35u8abni.run(/Users/alain/sites/biomesnil_medical/customers_after_sales_application/customers-after-sales/platforms/android/app/build.gradle:150)


BUILD SUCCESSFUL in 0s
23 actionable tasks: 6 executed, 17 up-to-date

But when i take a look at platforms/android/app/build/outputs directory, i just have the apk directory with the previous build apk file. There is no bundle directory.

No errors, no bundle directory, no AAB file.

I have updated android SDKs, Gradle (7.5.1), Cordova (8.1.2).

I have also tried with ./gradlew assembleRelease and it's the same.

I tried to remove android platform and create it again with no results.

I can stand what is wrong. Any idea ?

EDIT:

I have try to generate an AAB file from another ionic/cordova/angular project (on the same OSX computer) and every thing is ok, i get the AAB file.

EDIT 2:

As @NajamUsSaqib suggest i try compiling with ionic cordova build android --prod --release -- -- --packageType=bundle command.

Command terminated like this:

BUILD SUCCESSFUL in 4s
45 actionable tasks: 1 executed, 44 up-to-date
Built the following apk(s): 
        /Users/alain/sites/biomesnil_medical/customers_after_sales_application/customers-after-sales/platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk

No bundle directory is created an no AAB file is created.

Complete log: https://pastebin.com/7M0tKX66

EDIT 3:

After closing terminal and reopen it because cordova stay to 8.x in old terminal. Give a try with cordova 11 in new terminal but now i get errors: https://pastebin.com/5w5xw5VL

0 Answers
Related