I am new to JetPack Compose. I am leanring Compose and was following https://developer.android.com/jetpack/compose/tutorial
But when I ran the application in my android device, the app was extremely slow.
Simple things like expanding long message and changing color of message is taking so much time.
I have googled the problem and found:
https://www.reddit.com/r/androiddev/comments/oatiur/why_simple_app_with_jetpack_compose_is_5x_times/
https://github.com/android/compose-samples/issues/21
https://jetc.dev/slack/2021-03-14-why-so-slow.html
Jetpack Compose Performance Issue that only occurs in multi module project
But none of these were helpful to me.
If there is any confusion, please tell in the comments.
I experienced the same thing. What is currently happening is:-
1.) App Startup is kinda slow
2.) App is glitchy upon start
The good news is:-
1.) The glitches only happen for the first few times you run the animation,
2.) The glitches seem to disappear from every element after you break one of the elements in.
The bad news is of course, you have to repeat the above steps upon EVERY startup. I have heard that running the production builds instead of the debug variants boosts up the performance significantly. As of now, there's nothing you can do about it. It will only break in as Compose develops. You can check the official Compose Samples too. They are as glitchy as your apps.
All you can really do at this point is wait.
EDITS BASED ON THE COMMENTS BELOW:-
1.) By The glitches seem to disappear from every element after you break one of the elements in., I mean that if you have a lot of animated content, like maybe two LazyColumns, and a few others, then upon swiping the Column back and forth a few times (breaking it in), the lag will be gone from the other columns, as well as the animated content. Element there meant element of the screen, so individual LazyColumns are each elements.
2.) To get the production build, all you need to do is click on the release tab in the left edge of the screen in studio, then select release from the dropdown list instead of debug. 'Production' was substituted by me for 'release', but it's one and the same thing you see.
Related
So I have been trying to create a pretty basic calculator app.
I converted my RelativeLayout to a ConstraintLayout and started creating constraints.
After some time I noticed that while creating new constraints, the older ones get deleted.
Why is this happening?
I'm pretty new to Android development so I'm just trying to learn Android, my apologies if this is a low quality question.
Hoping to see some answer regarding this happening. I did some research on Google & YouTube and StackExchange, I'm sure I did everything correctly, just the constraints themself started disappearing after some time.
That could happen because constrain layout is still in beta. This will come with a lot of bug like these for instance. It could happen that it deleted all the constrains or maybe u accidentally pressed the 'clear all constrains' button in android studio.
You can check if constrains are still there by looking in to the text tab in edition to the design tab. And look for
app:layout_constraintRight_toRightOf="parent"
or any other variaty.
Since the constraint layout is still in beta. I would recommend just using the other layouts of android (Linear, grid, relative etc.).
As many other Ionic developers I'm experiencing slow state changes on Android. My problem; it takes a few hundred milliseconds before the app starts to make the transition. I'm using native transitions and crosswalk, so the when the transition is being performed it's smooth.
My best guess is that the timeline looks like this:
1) Button is pressed, activating the state change.
2) App loads the new state
3) Transition being performed to the new state
Step number 2 is what seems to take a few hundred milliseconds, and I really thought this would be solved by Ionics view caching, but it didn't seem to make any difference.
My views are mostly static, so my idea is to find a way to cache the views properly, and manually trigger when the cache should be cleared.
Do you know how this can be done? Or if you have a better idea of how this can be solved, I'd really appreciate it if you could share your advice.
I'm using a TListBox component to display a list with CheckBoxes.
It works very well on iOS, but on Android it generates a small lag when scrolling.
At the first glance, I thought it would be due it's design of each TListBoxItem being a container of Controls. However, when generating a simple List (without CheckBoxes) it remains to lag a little bit.
Is it a problem with the component?
Is there any solution that does not evolve removing any of my ListBoxes?
For the first question
Note: FMX.ListBox.TListBox performance can be slow on mobile. Use TListView if you want to develop more complex applications, especially apps with large databases.
From Embarcadero docwiki
For the second question
There may be. My solution would be to swap TListBox to TListView
If you need checkboxes in your listbox you can also do it with TListView. Set AccessosoryType to CheckBoxes.
I've been building for Android for six months now, and I'm still confused about how things happen in the UI. When I learned iOS programming, the books and docs were very clear about what happened when: for instance, that view changes and animations didn't take effect until the next iteration through the run loop. This understanding is critical to debugging UI glitches, and without it I'm having trouble tracking stuff down in our Android app (http://emu.is/download/).
For instance:
We had a situation where pressing a button brought up a fragment, and also displayed an animation as feedback for the button click. I started the animation before pulling in the fragment, yet it didn't actually run until after the fragment appeared. Why?
Often, opening a new Activity will take a long time, during which the user doesn't have great feedback that anything is happening. I'd love to pull up a minimal container for the Activity, then load its content, so the user knows what's happening. How do I do that?
Sometimes our chat bubbles (which are drawn programmatically via a custom Drawable) flash a bit, and it looks like they're being rendered halfway through their drawing process. Why? How do I avoid that?
And so forth. Basically I'd like to understand as much as possible about what happens when in the Android UI -- not just the lifecycle stuff that's well-documented, but the relationship between various UI calls and when/how things actually happen onscreen. Thanks.
i have written a somewhat small application , yet it runs very slowly on IOS and Android devices , it seems to me that the device takes much time to render the GUI.
i made sure to require every component needed on launch time, my application consists of 5 tab panels , each one contains a navigation view with multiple panels , i have set the autoDestroy property of navigation views to true.
i used sencha 2.0.0.0 and 2.0.1.1 and phone gap cordova 1.7.0 , cordova 1.8.0
Any suggestions?
i made sure to require every component needed on launch time
Because this, your application launches slow. The main reason is all of your elements are added to DOM tree right at startup time (you can inspect your application's DOM tree by Chrome's debugger tool to see it).
The best practice to optimize responsiveness of your application is discussed somewhere, here's one of them:
PhoneGap 1.4 wrapping Sencha Touch 2.X - What about performance?
For your situation, a better way to implement is:
Divide your application into 2 main views, an Ext.TabBar and an Ext.Container
Listen to changes in TabBar clicks, if user changes from a tab to another, remove your view in the main container and add appropriate views. It ensures your application only contains exactly 2 views at any time.
Hope it helps.