I am developing an application in React Native. I just installed the release apk in my phone and all the fetch() responses are same as expected one.
But then I did changes in code. I built the release apk again. I installed the application without uninstalling the old one. Now the fetch responses are totally different.
It works fine if I reinstall it.
I don't know what is wrong in that. Is there anything like clearing caches or something needed to update the app?
Related
I have an React Native application that was created without using Expo. So, I have to manually manage a bunch of stuff. Not my choice.
I noticed that the package.json has a version field. However, as far as I understand, if I want to deploy my app to the app stores, I have to set the new versions in Android Studio and Xcode.
So, what's the point of the version number in package.json? Is it just like leaving yourself a note? Does it matter if you even use it?
I have created a react native using app and created an apk for that using expo. Now I have to make some modification in that app. So do I need to build that again using build:android? or Is there any method to modify content in bundled app
If you have the over-the-air updates that expo offers enabled (I believe it's enabled by default), then whenever you publish your app (expo publish), the app on your phone will update automatically (you don't need to download the new apk). That also works when the app is on Play Store.
The way this works, is basically the app requests an updated js file from a public url on launch and runs that js instead of the old one. I personally dislike this approach so I disabled OTA updates for my app. In case you do too, then, you either need to manually listen for updates in your app (please refer to the above link) or install the new apk every time you build a new version (this is only useful in development).
When I changed a library (like 'react-native-image-crop-picker') version on package.json and distribute it with code push in users app the version not changed.
They see older version of that library in app.
what should I do?
Code Push only works with JS code. It doesn't allow to push native binaries. In your case, you have to update app bundles in stores to update your native dependencies.
The CodePush plugin helps get product improvements in front of your end users instantly, by keeping your JavaScript and images synchronized with updates you release to the CodePush server.
Taken from Code Push docs.
I have a react-native app that is using Expo.
In the beginning of the project I pushed some code to the default publishing channel that was never intended to be used in production.
Since then I have released dozens of versions to production and mostly all works as expected. (New installs gets the latest JS code)
However, a few users still gets old versions of the code, even though they literally just downloaded the app from App Store / Google Play.
This is extremely frustrating. How can I make sure that fresh downloads of the app will download the correct/latest version och my JS?
Note that this is not related to the app detecting new code that might be available for download. It is the fact that the wrong code is downloaded and used to begin with. Is there any way to remove all JS-code except the very last version that I published? I imagine that would solve my issue
Turns out, expo don’t always do this successfully. You need to rebuild the react native bundle before publishing.https://proandroiddev.com/bundling-react-native-during-android-release-builds-ec52c24e200d
This is what expo gives as a feature known as Over the Air updates (OTA). Whenever a new version is built with expo channel, it automatically updates even in the app store and play store. But there is a way to disable the updates. the expo documentation for disabling:
It is possible to entirely disable OTA JavaScript updates in a standalone app, by setting updates.enabled to false in app.json. This will ignore all code paths that fetch app bundles from Expo's servers. In this case, all updates to your app will need to be routed through the iOS App Store and/or Google Play Store.
This setting is ignored in the Expo client.
And I do recommend you to read the documents of OTA, which is a good feature when you get to know all of it.
The expo link is expo OTA
could somebody explain how the Expo client decides whether to refresh my app or use the current version cached (~already downloaded) in the client?
When I'm pushing out a new version with exp push, the Expo app (on Android) doesn't seem to pick it up, unless I clear all data of the app.
I thought that bumping the expo.version in the app.json would solve this but this doesn't seem to be the case.
Thanks!
UPDATE
Ok, I understand it is supposed to happen automatically, but this doesn't seem so - I tried multiple devices which were not offline - I suppose there must be something obvious I'm missing...
https://docs.expo.io/versions/latest/guides/offline-support.html#load-js-updates-in-the-background
Check that you don't have this option on the app.json file:
"updates": {
"fallbackToCacheTimeout": 0
},
I had this option in there and it prevented the app from waiting for a new version to be downloaded.
(on Android) I succeeded by opening the app in Expo, I would see the cached version, then I force stopped the app intentionally, both the app and the expo client. This removes it from the list of open apps on the phone.
Relaunched the expo client, then tapped my demo app again, and it loaded the new version. Tested a few seconds after publishing.