Adding cordova to an existing vue app

Дусал нэвтэрхий толь-с

It turns out that adding cordova to an existing vue app is pretty easy – if only I’d known this before trying at least 10 different ways:

First, make sure your environment is setup

npm install -g cordova
npm install -g @vue/cli

clone your existing repo and cd to its folder

git clone my-cool-app
cd ~/git/my-cool-app

You can now install your project dependencies and add cordova

npm install
vue add cordova

Next, follow the cordova wizard (it will show when you do vue add cordova): > Name of folder where cordova should be installed – src-cordova > Select Platforms: Android, iOS, Browser

To run your new cordova app:

npm run cordova-serve-browser

(urls must be ‘hash’ ones, eg /my-homepage becomes /#/my-homepage)

Next, you can do all the building and testing, using these commands

npm run cordova-serve-android # Development Android
npm run cordova-build-android # Build Android
npm run cordova-serve-ios # Development IOS
npm run cordova-build-ios # Build IOS
npm run cordova-serve-browser # Development Browser
npm run cordova-build-browser # Build Browser
npm run cordova-prepare # prepare for build

Install android system – build android apps

    Install jdk8 (create account at oracle, verify email, login and download)
    Install gradle (brew install gradle –
    Install android studio (and pick an skd –
    install android SDK (api level 28) – create a new project (a blank one) click on the sdk manager icon – top right (its not in tools > skd manager!)
    install android avd (api level 28) – create a new project (a blank one) click on the sdk manager icon – top right (its not in tools > avd manager!)

Once you have all this, you can emulate and build for the android platform

npm run cordova-build-android


jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/git/my-cool-app/src-cordova/keys/my-release-key.keystore app.apk alias_name


find ~/Library/Android/sdk/build-tools -name "zipalign"

~/Library/Android/sdk/build-tools/29.0.0/zipalign -v 4 Project1.apk Project1-aligned.apk

You can then use the apk for testingTo upload into google play store, you need to send an aab. You’ll need to open your code in android studio to do that build: open android studio build > generate signed bundle (dont think this actually signs it though)

  • have to upload aab format

Install ios system – build ios apps

   Install xcode
   npm run cordova-build-ios

Install electron system – build electron apps

   install xcode
   brew install rpm
   cd src-cordova
   cordova platform add electron