Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serious issue of inconsistent content by deploying apk #591

Closed
NickIliev opened this issue Oct 19, 2016 · 26 comments
Closed

Serious issue of inconsistent content by deploying apk #591

NickIliev opened this issue Oct 19, 2016 · 26 comments

Comments

@NickIliev
Copy link

From @ryc16 on October 18, 2016 9:28

Tell us about the problem

I recently started to build a debug apk for easy of deploying various devices for testing (which also similar production deployment) but I encountered very strange behavior. Apk got deployed but content sometimes show updated and sometimes not. Also same apk deploy to 2 devices but one shows correctly but another devices shown incorrectly. This could be easy to tell looking at UI already. The problem happen randomly so very painful. I wish more people try this way and see if more people got the same problem.

Steps:
#1. build apk by "tns build android".
#2. copy the xxx_debug.apk from platforms\android\build\outputs\apk to my share place.
#3. I installed the apk to 2 devices. note: both devices had early version installed.

From app info, both devices got the same, in term of content, they look different see the attachment for 2 devices.

Device1: content not updated look like old UI.
hw.zip

Device2: content did updated show correctly
note2.zip

On device 1, Also try clean cache, clean data on the device, uninstall package from device package manager, then install apk from my share place. Still had same problem - correct app version but incorrect content.

Any idea? How can I further troubleshoot? How could I know what content I am running on?

I am a bit worry what happen if this is on production environment, Would user will face this problem? If so, user wouldn't know about it. So this is very critical issue.

Which platform(s) does your issue occur on?

Only tried on Android not IOS

Please provide the following version numbers that your issue occurs with:

>tns info
All NativeScript components versions information
┌──────────────────┬─────────────────┬────────────────┬───────────────┐
│ Component        │ Current version │ Latest version │ Information   │
│ nativescript     │ 2.3.0           │ 2.3.0          │ Up to date    │
│ tns-core-modules │ 2.3.0           │ 2.3.0          │ Up to date    │
│ tns-android      │ 2.3.0           │ 2.3.0          │ Up to date    │
│ tns-ios          │                 │ 2.3.0          │ Not installed │
└──────────────────┴─────────────────┴────────────────┴───────────────┘

Copied from original issue: NativeScript/NativeScript#2918

@NickIliev
Copy link
Author

From @ryc16 on October 18, 2016 11:5

In order to get the content up to date, I have to plug my device to my computer and use tns command.

tns livesync android --watch

Afterwards, everything works as expect.

Again, I am worry what would be happend if app is in production and install from ie google play store. Would this happen?

@Plamen5kov
Copy link
Contributor

Hi @ryc16,
I couldn't reproduce your problem when I repeated the steps you provided. I tried building the default application and installing it by hand on different emulator api levels: 17, 19, 21, 24. The resulting UI is the same. If you want us to help you, can you provide a small repo causing the problem and be more specific with the api versions you tried running the application on?

@ryc16
Copy link

ryc16 commented Oct 25, 2016

@Plamen5kov, this doesn't happen all the time. I just wonder how does the android deployment works. Where does the content running at? For example, running at /data/data//files or it actually running on different location? When apk got deployed, does the process delete all files (including cache files if exist)? Would it possible some files is being locked on the file system?

@Plamen5kov
Copy link
Contributor

@ryc16 when adb -r install <apk_name>-debug.apk is called, the application is copied on the device

  • for api level 17 in /data/app/<app_name>.apk and
  • for api level 24 in /data/app/<app_name>-1/base.apk

and then unpacked inside the folder you mentioned

/data/data/<full_app_name>/

When the app is uninstalled all these directories are deleted, so I can think of no way for the same app to have different behavior. I can suggest using the -r option on the adb command that will remove the previous application with the same name before installing the new one, or uninstalling manually before installation.

Adb command is:

adb install -r <apk_name>.apk

@ryc16
Copy link

ryc16 commented Oct 26, 2016

@Plamen5kov, I could try when it happen again (I didn't uninstall from device app manager which I think the same so not sure if adb -r helps). Is adb -r is the regular deployment process or handle by tns android cli? If your suggestion is just for troubleshooting, then it is ok otherwise this wouldn't be production solution. So there is no cache mechanism of running content, right? What about the javascript layer? Hope other people could replicate this problem.

@Plamen5kov
Copy link
Contributor

Is adb -r is the regular deployment process or handle by tns android cli?

@ryc16, yes the CLI uses -r as the default command when installing the application as you can see here.


So there is no cache mechanism of running content, right?

I can't tell you if android has a cache mechanism, I haven't looked into it.


If your suggestion is just for troubleshooting, then it is ok otherwise this wouldn't be production solution.

I can't reproduce the issues at hand, so it's a suggestion to help you isolate the problem. If we manage to do that, we can figure it out.

@Plamen5kov Plamen5kov self-assigned this Oct 26, 2016
@therevills
Copy link

therevills commented Nov 4, 2016

I've seen this issue too... very strange!

I updated an XML file to fix a spelling issue, tested it on a real Nexus 7 device worked fine. Uploaded the debug apk to a server and downloaded it to a real Motorola G and the old UI was still there!

@ryc16
Copy link

ryc16 commented Nov 6, 2016

Now more people are able to catch this strange problem. This kind of problem is very scary if it is on production. We don't know if user really running/showing the latest content.

@Plamen5kov
Copy link
Contributor

Hi @ryc16,
I agree with you, but you have to understand, if we can't reproduce your problem, we can't fix it. I would be grateful if you find a scenario, where this bug can be reproduced, so we can take it on.

@ryc16
Copy link

ryc16 commented Nov 7, 2016

Hi @Plamen5kov, understood. it is not consistent to me so not sure how to let you reproduce the problem.
@therevills, is it consistent to you? would you have anything for @Plamen5kov .

@Plamen5kov
Copy link
Contributor

@ryc16 did you mange to isolate the issue, or find a way for us to reproduce it?

@Plamen5kov
Copy link
Contributor

I'm closing this issue, because there's no response, but feel free to reopen it again, if you find a way to reproduce it.

@mayureshjadhav
Copy link

Hey, I am also facing the same issue. It's very frustrating. In my scenario, I added few images on app resources and when I tried to run the app. It shows me the previous content.

@mayureshjadhav
Copy link

I am using NativeSctipt 2.5

@mayureshjadhav
Copy link

mayureshjadhav commented Feb 14, 2017

I got the issue. The issue was I changed the NativeSctipt id but had not changed in app.gradle therefore it was giving me this kind issue. For more information you can refer NativeScript/nativescript-cli#2092

@Plamen5kov Plamen5kov reopened this Feb 14, 2017
@Plamen5kov
Copy link
Contributor

Hi @mayureshjadhav,
Could you provide steps to reproduce the problem. Keep in mind that when using livesync all changes made are passed directly to the device, and when all fixes using livesync are done a normal build needs to be made so a new .apk is generated: tns build android/ios.

@Plamen5kov
Copy link
Contributor

Will close this issue because there's no steps to reproduce and lack of interest. Feel free to reopen if someone can provide steps to reproduce.

@NathanaelA

This comment was marked as abuse.

@petekanev
Copy link
Contributor

petekanev commented Apr 9, 2017

@NathanaelA thanks for describing the process in details.

It just came to my attention that we face the problem internally too. I can finally confirm that this is indeed an issue with temp directory not being erased on certain devices, despite permissions being granted.

I would also like to add that the bug does not affect packages built in release, so publishing and updating applications should be safe.

@petekanev
Copy link
Contributor

Addressed with changes in PR #743 as well as some modifications inside the CLI version 3.0.0

@cjdreiss
Copy link

@Pip3r4o how do we go about getting this update?

Since I couldn't quite figure it out, this was a temporary workaround for me.
Based off of the comments, I was able to delete the files in /data/local/tmp/ using adb and now my apk that I installed is actually using the files from the apk.

to get the directory name, you can find it by running this

adb shell ls /data/local/tmp/

Then, I did

adb shell rm -rf /data/local/tmp/org.nativescript.MYAPPNAME

@petekanev
Copy link
Contributor

@cjdreiss 3.0.0 will be officially released next week. Using the 3.0 CLI and installing the 3.0 android runtime in your projects (even if you still use 2.5 modules) should prevent your files from going stale.

@NickIliev
Copy link
Author

+1 Reported via t.1119637 with tns-android 3.2.0

@petekanev
Copy link
Contributor

@NickIliev the changes released earlier this year unfortunately do not fix the problem occurring on Samsung devices.

@daveware-nv
Copy link

I can confirm this still happens with 3.3.1
to reproduce:

  • tns run android
  • kill livesync
  • make a noticeable edit to a template or something
  • either
    • tns build android and then adb install path/to/appName-debug.apk to the same device/emulator that the livesync was hooked up to
    • or tns deploy android to the same device/emulator that the livesync was hooked up to
  • the change/s will not be noticeable, and most appearance/behaviour will instead reflect the most recent livesync

This problem doesn't seem to affect release builds (tns build android --release) or clean deploy (tns deploy android --clean)

@waqasyousafy
Copy link

what is the solution plz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants