MRZ Rasya Gaming
MRZ Rasya Gaming

Reputation: 91

Unable to build app bundle (.aab) in Cordova?

I want to make an app bundle to upload app to the play store. But I have a problem when I create an app bundle, I get results as apk. I run this syntax:

cordova build android --prod --release -- -- --packageType=bundle

but the result of the syntax is

BUILD SUCCESSFUL in 4s
45 actionable tasks: 1 executed, 44 up-to-date
Built the following apk(s):
        E:\project\platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk

I use Cordova version 10.0.0 and android version android 7.1.4

Please help me, why can't I build an app bundle(.aab)?

Upvotes: 9

Views: 11780

Answers (2)

zeinFikry
zeinFikry

Reputation: 296

firstly, create a build.json file that contains config about your keystore. see this doc https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#using-buildjson

then use this command to build your app

cordova build android --release --buildConfig=build.json

Upvotes: 0

Moh
Moh

Reputation: 181

to build an App bundle, first build and generate your apk with

ionic cordova build android --prod --release

Then go into platforms/android folder and generate your bundle with gradlew using the following command

cd platforms/android && ./gradlew bundle

the bundle file can be found at the following folder

platforms/android/app/build/outputs/bundle/release

also according to Google 'Starting August 2021, new apps will be required to target API level 30'. You should target sdk version 30 and can easily do that by adding android-targetSdkVersion in your config.xml

<preference name="android-targetSdkVersion" value="30" />

Upvotes: 12

Related Questions