-
Notifications
You must be signed in to change notification settings - Fork 1k
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
bug: android performance issue #3229
Comments
Any chance you could provide a link to the source repos of your app for Capacitor and Cordova? |
@dwieeb Unfortunately, I cannot give a repo :( |
The slow performance is in other ionic apps too, like (for android) "Ionic 5 Starter app" |
I can confirm it too. I've tested on multiple android devices, quite new actually and same! Even tested on an older phone, Galaxy S8+ and same! Capacitor on Android is totally unusable... |
I've tested on pixel 2 xl and its very laggy. On Virtual device and real devices. |
Exactly, this has nothing to do with the source code itself. Even the simpler app is VERY laggy. Really, unusable ..., gonna try my luck with Cordova tho, see if I can get the same level of performance on Android as I get on iOS with Capacitor |
It seems we're experiencing this as well, but I can't seem to reproduce it on the cheap Android phone I have (Mi A2 Lite, Android 10). @BerkeAras @allocenx are you also using |
I am using the default LAN ip to serve, which is like 192.168.1.xxx:8080. It's not only on cheap android phones, I've tried on high-end ones too... |
@dwieeb Sorry for tagging you here as well, but this is quite urgent, android builds are really unusable... |
So if you try without the |
This seems like it is likely going to come down to configuration or something. We are going to need a repo for an app that demonstrates the issue. Obviously not anything proprietary you are working on (I saw someone say they couldn't give a repo, and that is likely true for your production app, but if you can reproduce this outside of that app, you should be able to easily provide that). I have been working on updates to several Enterprise Support related demo apps. They are all Capacitor apps and are all using version 2.4.0. None of them are having performance lags on Android. Being demo apps, none of them are overly complex, but they also are not trivial. They are a mix of tab style and side-menu style apps. I have been testing on a Pixel 2 and Pixel 4, both on Android 10. If someone can provide a reproduction, I will compare it to the apps I have been working on to see that the differences are. |
Well, I'm using quasar with capacitor to provide mobile builds, and in my capacitor config this is all i have:
|
Server does nothing actually. It automatically gets the ip specified using command "quasar dev --mode capacitor --target android", i select there the ip, either lan or wan one. |
Is it something else, i am missing for android alone? On iOS, the mobile build is butter smooth, no matter the model of the iPhone. |
On iOS it is still laggy for me, but it is better than android. On iOS something like swiping modals up and down is laggy, but on android everything is laggy. If I click a button on android, the ripple-effect is soo slow. |
I've just opened #3485 and at the end I noticed that when using a remote server, on iOS Capacitor works correctly but on Android it looks like it runs on a web platform, not natively. Maybe that's related to these performance issues. You can check by opening the device dev tools via |
@mhartington What do you say to that? |
Actually no..., mine is true. Just checked. |
Please provide a sample project to inspect. If you cannot provide a sample repo, there's no way to isolate if this is due to capacitor or a users app itself. As I've stated in other issues/discussions/forum posts... debugging is key here. https://www.youtube.com/watch?v=7XgrrO1h7Wo&lc=UgwX-p0tZBTfvLeH_vd4AaABAg Use the devtools provided by the browser and inspect your app. Any performance issues that could appear are often due to the app and not capacitor. |
Oke will try to share it ASAP. |
I've definitely noticed a difference in slowness when bundling our Stencil + Ionic PWA into the native app, vs loading it from a remote server. I think this would be reproducible with a basic app as well. I will try reproducing it with the ionic-stencil-conference-app soon. The first thing I noticed is that opening the keyboard takes way longer when the app has been loaded from the remote server. Some logs that confirm that something is going on:
(don't mind the type errors about Our app has a service worker, so there's no issues with loading time of the files btw. |
|
|
@simonhaenisch more context? Are you loading this from a remote server? Your message is not clear. Are you loading this from device as a native app? What kind of device are you using? What hosting provider (if any) are you using? |
Yes, the idea is to load the app from a remote server (instead of bundling it into the app). After seeing the comments in this SO question it seems like Capacitor is not intended to be used that way and the A service worker caches the whole app on first launch so that it's available offline and has similar loading performance to a normal bundled Capacitor app. This works on web but I didn't get it to work properly with the native app yet (which is one thing I'm working on at the moment).
Yes (as mentioned in a previous comment), I'm running it as a native app on a Mi A2 Lite with Android 10.
Our production app is hosted on Vercel, but for testing/debugging I've been using I've tried reproducing it with the |
Yeah, your situation is a bit unique here. But yeah, the server field is for testing, not for production use cases. This is actually against app store terms of service, as the content of the app could change to be anything, without being reviewed by the app store. So I would not recommend doing this unless you're building enterprise apps that won't be deployed to the app store. As for other concerns, it seems rather specific to your setup, vs a typical setup. |
I do not use the server configuration in the capacitor config file. That is my actual config file: https://pastebin.berkearas.de/?40b34dd6310ee2ec#5MNRx9icVprtVrKEqpnmzHcyiN38RZCeANf4zRuQ7Yog. What should I change? |
@BerkeAras nothing stand out there. But if this is the same app from our discussion before, I'd suggest running your app through Chrome's Lighthouse audit tool. This should provide more details into your specific use case. |
Can you point me to the terms of service that state this cause to my latest knowledge that is not the case anymore? I've checked https://developer.apple.com/app-store/review/guidelines/ and there's nothing that indicates that it's not allowed to load the app from a remote server. The only relevant section I could find is 4.2.3 (ii):
(which means we need to have some fallback mechanism for when the app server is unreachable but that's relatively trivial because the app is unusable without the backend service anyway) If it was forbidden, then how are Ionic Appflow Live Updates legal? The app could also change to anything really. |
@simonhaenisch It is not allowed to change the functionality without review by apple. But I do not know how AppFlows Live Updates can be legal. |
Do you have the source for that? This is pretty open to interpretation depending on how specific it is (e. g. bug fixes don't really change functionality). The only other thing I just found on https://developer.apple.com/app-store/review/ is
But I don't think this means hybrid apps which are webapps but make use of native features (via Capacitor/Cordova/etc). IMO it shouldn't really matter whether the web part of the app is delivered as files in the app, from a server, or Appflow Live Update. |
This is getting off topic for the issue and is better suited for a forum post or discussion. But the source is here https://developer.apple.com/news/?id=09062019b Basically, the app's code should be local to the device, and not loaded via the network. Appflow is allowed as the web content is still part of the app binary. When an update it deployed, that is downloaded and becomes the main app content. The big key here is that the app (html,css,js) are local to the device and not fetched over the network. |
Alright thanks for the info. I kind of find the announcement a bit contradicting to 4.7 though because it starts with "Apps may contain or run code that is not embedded in the binary" but yeah it's getting too off-topic (and the Ionic team definitely has more experience with the App Store team than me 😅). Anyway, I'll stop working on a reproduction then since you're not planning to support this as a production use case. |
Lets come to the main topic of that issue: The bad performance. |
Most of the performance issues come from the front end side, not capacitor specifically. Please audit your app using things like lighthouse or other performance tools. If the app is the same one from the discussion thread, the performance numbers clearly show that the web app has some significant issues. |
But in that case it is not the frontend side. So many apps are slow on android. It has nothing to do with frontend in that case. I tried creating an app just with IonMenu and a IonButton which opens IonModal. That was very laggy. |
Then make a test case and provide that. Please provide something otherwise we're just going to go back and forth here without any resolution. If it happens in an app that just has ion-menu with a button, then it should be something you can recreate and share here on github. If there is no test case, I'm afraid we'll have to close this issue since there isn't anything we can test and measure. |
@mhartington I am creating a repository ASAP. |
@mhartington Sorry for that late reply. Here is a repo: https://github.com/BerkeAras/Capacitor-Bad-Performance-Issue. If you directly want to install the APK: https://root.berkearas.de/app-release.apk |
Looking into it, there's a few things that stand out as bad practices.
When running this through lighthouse before even deploying to the device, I see there's some performance issues already. This is emulating 3g network.
The project should not be setup this way. Since node_module include a lot more resource than is needed for the app. This can be avoided by having a framework that includes some build process, this is avoided and you build optimized JS.
Not sure if this is typo or mistake, but the test case has a web component defined within another web component. Not sure why that is the case, but should be avoided. So there's a lot of bad practices that could be avoided and help performance, but overall Im not seeing any performance issues. And any performance issues typically would be part of the frontend (framework of choice like angular/react), not really capacitor. If an app had performance issues, I'd expect them to be outside of capacitor as well. Given all of this, I think we can close this issue. |
@mhartington Please reopen this issue. You should not close the issue because of this reproduction app. There are many people with the same performance problem. 1) How would you increase the performance. There is one image, and just ionic components. Isn't this an framework problem? |
@BerkeAras Please post on the forum Github issues are for issues specifically related to capacitor. These are more support questions and how-to's. |
But there is a capacitor problem. What about the comments of the other users here? |
In my experience, issues with extremely vague titles attract a lot of attention from search engines because they're easy terms to search. Also, Google prefers issues with lots of comments (this one has over 40 already). These issues are for specific bugs/features that are actionable. I'm not even seeing it narrowed down to an issue with Capacitor or the Ionic Framework or your app, yet. However, Capacitor is over two years old and has thousands of successful apps deployed on the App Store and Play Store. I think we'd hear a bit more from users if they were experiencing "very bad performance". Debug and uncover the issue, then post a reproducible set of steps to help us analyze the issue if it's the fault of Capacitor or Ionic Framework. It is rare for @mhartington to devote so much of his time to helping people uncover issues like this. Use the Ionic Forum for community support on Ionic Framework. Use this repo's Discussions for community support on Capacitor. If you're on a team building a mission-critical app and need expert advice, our Enterprise-tier Advisory services are available. Our sales team is always willing to talk. |
Bug Report
Capacitor Version
Platform(s)
Current Behavior
The App is very slow on android. The iOS App is OK. Same app just with cordova is faster.
Expected Behavior
App should run fast.
Other Technical Details
npm --version
output:6.14.4
node --version
output:v12.18.0
See video for more details: https://youtu.be/z5eqC4249QM
The text was updated successfully, but these errors were encountered: