Adding cordova to an existing vue app

Дусал нэвтэрхий толь-с
12:34, 30 Наймдугаар сар 2019-ий байдлаарх Almas (Яриа | оруулсан хувь нэмэр) хэрэглэгчийн хийсэн залруулга
(ялгаа) ←Хуучны засвар | Одоогийн засвар (ялгаа) | Дараагийн засвар→ (ялгаа)

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

https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html

    Install jdk8 (create account at oracle, verify email, login and download)
    Install gradle (brew install gradle – https://gradle.org/install/)
    Install android studio (and pick an skd – https://developer.android.com/studio/install)
    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

sign:

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

zipalign:

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

https://github.com/apache/cordova-android/issues/610

Install ios system – build ios apps

   Install xcode
   npm run cordova-build-ios
   https://www.softwire.com/blog/2016/10/12/submitting-cordova-app-apple-app-store/index.html
   https://developer.apple.com/support/app-store-connect/

Install electron system – build electron apps

   install xcode
   brew install rpm
   cd src-cordova
   cordova platform add electron
   https://www.electron.build/

Sources: