Old install not getting overwritten


#1

I’m trying to figure out why when installing from an apk, previous installs of the app aren’t always overwritten. Here is the case I just ran into:

  1. Yesterday I built an apk file with tns build android --bundle and uploaded it to google drive.
  2. This morning I made some visual changes to the app (in some of the html files) and was debugging with usb cable via tns run android.
  3. Then I wanted to test yesterday’s apk file (when a coworker tried to install from the google apk, the css wasn’t showing up) so I uninstalled the app from my android device, disconnected the usb cable, and download installed yesterday’s apk file from google drive.
  4. When I open the app I’m still seeing the visual changes I made this morning. There is no way they should be in the apk uploaded to google drive so it’s not getting installed.

My androidManifest has the following:

		android:name="com.tns.NativeScriptApplication"
		tools:replace="android:allowBackup"
		android:allowBackup="false"
		android:icon="@drawable/icon"
		android:label="@string/app_name"
		android:theme="@style/AppTheme">

When uninstalling an android app isn’t it wiped completely?


#2

This also happens if I don’t use the --bundle flag. ie. if I make a code change (something simple like a text change to one of the .html files) in the project, and then do tns build android, and then copy that apk to my phone (I can see the apk was overwritten with a new datestamp) and then install this new apk I don’t see the code changes. But if I make the code change and then connect via usb and do tns run android, I see the code change.


#3

Looks like this is a reported problem. The temp fix that works for me is to create a keystore and do my builds using the --release param.

In summary it looks like there is a bug where if you do tns run android and then tns build android (without --release) some of the files won’t get overwritten from the debug session, but by adding the --release param you can mitigate the issue.


#4

whenever you make changes, they are pushed to your device NOT to you build folder! so to reflect changes and they are final, run a new build command, or remove your platform and

tns platform add yourPlatform
//then build
tns build yourPlatform

you are set!! when you run on your device, it will automatically uninstall the app on your device and re-install with the new changes, also the apk will have the most recent changes updated!!:grinning:


#5

Are you saying that I need to re-add the platform every time with tns platform add before running tns build to generate the new apk with all changes? If so I wasn’t aware that was the case, I thought just tns build was supposed to be sufficient to get the new up to date apk.


#6
tns build  

will do but in case you added a plugin or updated anything in your app then tns remove platform before building, did you try? what was the outcome?


#7

Yes, I can confirm this issue. I faced it recently.
I ended up making a release build.