Max F
Max F

Reputation: 121

Ionic build creates an old version of my app even if I create a new blank app

Every time I run ionic cordova build android and then ionic cordova emulate android, I get a version my app from maybe a month ago. Here's what I've tried:

  1. I've deleted files including deleting them from /platforms/android to no effect.
  2. I've tried updating my version number in my config.xml file.
  3. I've tried deleting the APK and various other files from /build/android
  4. I tried creating a new ionic app with ionic start and then after cding into the new directory for my new project and running the same two commands, I got the old version of my other app.
  5. I've tried removing and then adding back cordova android with both the commands ionic cordova rm/add platform android and cordova rm/add platform android and these cause some bizarre responses. With the ionic prefix, the remove command works fine but on add, I get this:

...

C:\Users\max\Documents\omsLibrary>ionic cordova platform add android
cordova platform add android --save
√ Running command - done!
ionic cordova resources android --force
√ Collecting resource configuration and source images - done!
Platform android not detected. Would you like to install it? (Y/n)

Update: after globally installing cordova, I no longer get the above on add. I just get this:

cordova platform add android --save
× Running command - failed!
[WARN] Platform already added. Saving platforms to config.xml.
> cordova platform save
√ Running command - done!

[ERROR] No platforms detected. Please run: ionic cordova platform add

I can keep doing this forever if I want but it will keep giving me the same circular instructions.

I have no problems at all with ionic serve.

Here is what I get from ionic info (updated after following Suraj Rao's suggestion):

cli packages: (C:\Users\max\Documents\omsLibrary\node_modules)

    @ionic/cli-utils  : 1.13.1
    ionic (Ionic CLI) : 3.13.1

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 1.3.7
    Cordova Platforms  : android 6.2.3 ios 4.4.0
    Ionic Framework    : ionic-angular 3.7.1

System:

    Android SDK Tools : 26.1.1
    Node              : v6.9.2
    npm               : 5.4.2
    OS                : Windows 10

Misc:

    backend : pro

Here's what I get from the cordova ls command:

cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-inapppurchase 1.1.0 "In App Purchase"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"

What is the deal here? Do I just wipe and reinstall everything related to ionic and cordova? Thanks to anyone who can provide assistance!

Upvotes: 3

Views: 5235

Answers (3)

Ayhan Kesicioglu
Ayhan Kesicioglu

Reputation: 488

Your app is updating background from your ionic dashboard. So you can delete app from dashboard:
1. Go to your ionic dashboard https://dashboard.ionicframework.com
2. Delete app

or you can remove update plugin (cordova-plugin-ionic):
3. Open terminal and

cd your_project_folder

4. Uninstall cordova-plugin-ionic

cordova plugin remove cordova-plugin-ionic

or both.

Upvotes: 2

Max F
Max F

Reputation: 121

I finally figured this one out. Apparently, when I was first starting the project and I didn’t know what I was doing (not that I really know what I’m doing now!), I copied the contents of my project folder (max/documents/myapp) into its parent folder (max/documents) because I was making some change that I was worried would break things. I completely forgot I had done this. When I deleted all those files from my documents folder, it worked!

So what I think was happening was the different mechanisms in the build process used different logic to determine where the project and platforms folders are.The add platform command was adding the platform to its right location, but the find platform command was looking I suppose in /max rather than /max/documents for the platforms folder and failing to find it. Then the copy project files to build folder command was finding the correct destination but looking in /documents rather than /documents/myapp to find the files to be copied over to /max/documents/platforms/android and finding the code from my ancient version of the app.

Upvotes: 0

Suraj Rao
Suraj Rao

Reputation: 29625

cordova (Cordova CLI) : not installed

You need to install cordova globally along with ionic cli.

Do:

npm i cordova -g

Upvotes: 1

Related Questions