Android apk shows old content on second execution [SOLVED]


#1

Hi to everyone, i’m building my app using the command:

ionic cordova build --release --prod android

After building my apk, i sign the file.

After installing the app on my android phone, everything works correctly, but if I kill the app (or open the app again), and old version is shown.

I’ve tried changing the version
Deleting the platforms folder

Nothing seems to fix the issue, any ideas?


#2

Are you using Ionic Pro Live Deploy?
What is your ionic info output?


#3

Hi, no, i’m deploying manually.
Thanks

cli packages: (/opt/node/lib/node_modules)
    @ionic/cli-utils  : 1.19.1
    ionic (Ionic CLI) : 3.19.1
global packages:
    cordova (Cordova CLI) : 7.1.0 
local packages:
    @ionic/app-scripts : 3.0.0
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.7.1
System:
    Android SDK Tools : 25.2.5
    Node              : v8.9.4
    npm               : 5.6.0 
    OS                : Linux 4.13
Environment Variables:
    ANDROID_HOME : /opt/android
Misc:
    backend : pro

#4

What does your package.json look like?


#5

But do you have the Deploy code in your app and the app configured that way? Also commited to the Ionic Pro Git repo?


#6

I was using ionic pro, to build everything, but we where unable to build our app to ios and had to to build the app manually (on a mac computer), since whe where also building our app locally, we stopped using the package building tools.

@SigmundFroyd Our package.json looks:

{
  "name": "xxx",
  "version": "1.0.1",
  "author": "xxx",
  "homepage": "http://www.xxx.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build --prod",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.4.3",
    "@angular/compiler": "4.4.3",
    "@angular/compiler-cli": "4.4.3",
    "@angular/core": "4.4.3",
    "@angular/forms": "4.4.3",
    "@angular/http": "4.4.3",
    "@angular/platform-browser": "4.4.3",
    "@angular/platform-browser-dynamic": "4.4.3",
    "@ionic-native/core": "4.3.0",
    "@ionic-native/document-viewer": "^4.6.0",
    "@ionic-native/splash-screen": "4.3.0",
    "@ionic-native/status-bar": "4.3.0",
    "@ionic/storage": "2.0.1",
    "cordova-android": "6.3.0",
    "cordova-browser": "^4.1.0",
    "cordova-ios": "^4.5.4",
    "cordova-plugin-add-swift-support": "^1.7.2",
    "cordova-plugin-device": "^1.1.7",
    "cordova-plugin-document-viewer": "^0.9.9",
    "cordova-plugin-ionic": "^1.1.9",
    "cordova-plugin-splashscreen": "^4.1.0",
    "cordova-plugin-statusbar": "^2.4.1",
    "cordova-plugin-whitelist": "^1.3.3",
    "font-awesome": "4.7.0",
    "ionic-angular": "3.7.1",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "rxjs": "5.4.3",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.0.0",
    "typescript": "2.3.4"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-whitelist": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-ionic": {
        "APP_ID": "f5b0ea84",
        "CHANNEL_NAME": "Master",
        "UPDATE_METHOD": "background",
        "UPDATE_API": "https://api.ionicjs.com",
        "MAX_STORE": "2"
      },
      "cordova-plugin-document-viewer": {}
    },
    "platforms": [
      "browser",
      "ios",
      "android"
    ]
  }
}

#7

Yup, this is the issue. Since you’re building manually now I believe you want to entirely remove the cordova-plugin-ionic plugin.


#8

@SigmundFroyd thanks, i’m going to try right now, I will be back in 5 minutes


#9

Seems that everything is working correctly! thanks!


#10

One question, why is this enabled when doing a --release, it should only work when developing your app.


#11

I believe that it also allows you to push out updates without going through the app store, hence it also being enabled in a release build.


#12

Thanks for answering!