Start a new topic

Flutter Hot Reload/Restart not updating the AR Scene

As mentioned in the title, I've encountered the problem that hot reloading/restarting with the Flutter Demo App from Github and custom app as well is not working for the JS AR contents (Flutter 1.14, Wikitude 8.10). The "normal" Flutter part is reloading as expected. It seems to make no difference if it is loaded from local or hosted (Apache2) and loaded via http.


It perfectly works with the Wikitude Browser from App Store, but In-App I always have to Stop and Start again (flutter run).


I'm not quite sure, but could it be that the WebViews on iOS and Android are caching? 


Hi Daniel,


It is true that the Hot Reload functionallity is not working for the JS AR contents. 


The problem is that when you open the arview.dart, you are creating an instance of our wikitude plugin which is opening the camera, loading the example and so on. When you change anything in the JS part, since this is an internal change in the sample that is load throw the wikitude plugin and Flutter doesn't know anything about reloading the samples in the Wikitude plugin, the Hot Reload won't do anything but show the same view. For a good use of the Hot Reload, we would need that when any change happens in the JS part, Flutter calls the Wikitude plugin to reload the sample that has internally loaded, which is not possible at the moment.


Regards,


Aitor.

Thanks for your response. Ok I think I understand why hot reload isn't working. But I have the same problem when loading the JS AR contents via network http://ip:port. 


So when using the Custom URL Launcher and loading http://192.168.0.1:8080 for example, changes made are not loaded when reloading the url. But it works with the Wikitude Browser app. Therefore I thought it might be that the WebView is caching and not reloading from server. But not sure if that's the reason why it's not loading the changes.


Thanks.

Hi again,


Do you mean it is not reloading without pausing and resuming the view? It's exactly the same, we are clearing the cache once the activity is being destroyed so we reuse most of the resources/ don't load again, so when using the Hot Reload the cache is still undestroyed.


Regards,


Aitor.

It's not reloading until reinstalling the app. Closing and restarting also did not work.

A ticket has been created for further investigation.


1 person likes this

Hi Daniel,


I did more tests about your issue, and unfortunately i could not reproduce them. 


What i did is to create a free host domain to do some tests with a custom page and uploaded an index.html file with some text there. Then i used the Custom Url functionallity that is available in the Flutter app and loaded the URL. Once it was loaded, i change the index.html text, went back in the Flutter app to enter the Custom URL again and when the page was loaded, the text was changed.


I think i have followed your steps, and at least i can assure you that nothing is cached.  If you find something weird in what i did, please let me know, otherwise i would need more details of your issue, as long as some code to test with.


Regards,


Aitor.

Hi there


I've also just been bitten by this. I'm using Flutter 3.0.3 and when I change any html/css/js file the changes are not reflected, neither in hot reload not in hot restart. I need to stop the app fully and then rebuild, which in my case takes about 3-4 minutes, so that is a very slow development cycle.


Maybe I'm loading this wrong?


I'm doing:

Future<void> onArchitectWidgetCreated() async {
architectWidget.load(
"static/webpage/index.html", onLoadSuccess, onLoadFailed);
architectWidget.resume();
subscribeLocationUpdates();
}



and the architectWidget itself is build in initState():


@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);

architectWidget = ArchitectWidget(
onArchitectWidgetCreated: onArchitectWidgetCreated,
licenseKey: '…',
startupConfiguration: StartupConfiguration(),
features: const ["image_tracking", "geo"],
);


Or is there a way to "invalidate" the cache? Or serve the files via http?

Hi,


Unfortunately I couldn't find a way to be able to use the hot reload/hot restart funtionallity when changing the html/css/js files. The code you sent looks OK, did you try to pause the sample, like navigating to the main menu, press to the hot reload button and open the sample again?


I'll create an internal ticket to investigate how can we enable this from our side.


Best regards,

Aitor.

@Aitor: Sorry for the late reply - I was off for 5 weeks :)

Yes I was changing the html/css/js files, did hot restart which leads me to the home screen and then loaded the screen with AR - but the files were not re-read, they were somehow cached

Login or Signup to post a comment