skip to Main Content

I have inherited an Android Studio project from a previous developer that uses Cordova. This is a template that we have used for three years for each new app we build. I have very little experience with building in Android and have Googled my way through so far.

With the August 2021 update on Google Play Store I’m now needing to submit our newest app in bundle format, but I don’t seem to have a way to do this.

I have seen guides referring to a ‘Generate apk/bundle’ option that should be visible under ‘build’ from the top menu, but this option is not visible for me:

enter image description here

Whenever I’ve used this template before, there was a message displayed saying "Migrate Project to Gradle? This project does not use the Gradle build system". My understanding from a day of research is that although my module had a build.gradle folder, the top level project also needed one (and a settings.gradle file). This seems to have worked as there is now a ‘Gradle’ that syncs successfully when I make a change.

When I use the command ‘cordova build‘, the project is building successfully.

I’ve also read that you can use gradlew bundlerelease to generate a bundle, but if I use gradlew tasks then there is no task available relating to bundling.

I’d really appreciate any advice on how I bundle this app please.

EDIT: By changing directory into app/platforms/android, the gradlew bundlerelease function works. I receive a BUILD SUCCESSFUL message, but nothing is actually being generated.

2

Answers


  1. Chosen as BEST ANSWER

    In case anyone is reading this in the future, thought I'd post my solution here.

    My issue was that after manually adding the top project-level build.gradle and gradle.settings files, Android Studio converted it to be Gradle-based and somehow my existing module was not recognised. I had to create a new module inside the project, upgrade Cordova to 10.0.0 and migrate the project to Android X.

    After the above changes, the menu option to generate the app bundle existed and finally worked.


  2. You should be able to generate the bundle using

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

    See https://github.com/apache/cordova-android/issues/729 for more details

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search