https://kotlinlang.org logo
#compose
Title
# compose
j

Jan

04/29/2022, 4:45 PM
I don't know how to describe my problem, but I try it: When my App opens, it checks for a new version and if there's no new version it continues with the main app which also gets some data from an api. Now this should be a pretty easy task and the things being downloaded are very small. But sometimes with my wifi (and worse with only mobile data). My app takes very long to load. I don't know whats causing this. I mean the rendering is independent of the network thing it should give me something but its just a white screen
k

Kirill Grouchnikov

04/29/2022, 5:07 PM
Is this a compose thing, an android thing, a desktop thing, a general thing?
j

Jan

04/29/2022, 5:08 PM
android thing
k

Kirill Grouchnikov

04/29/2022, 5:11 PM
Then this is not the right channel, and not the right Slack
j

Jan

04/29/2022, 5:12 PM
I mean I'm using jetpack compose
on android
k

Kirill Grouchnikov

04/29/2022, 5:25 PM
You can add some logging in that network task when it completes, as well as in your main UI when it starts and finishes loading, and see if these two things are indeed as independent as you aim them to be.
j

Jan

04/29/2022, 9:02 PM
I get this in the console but don't know what it means:
Copy code
2022-04-29 23:01:45.947 22416-22416/io.github.jan.shopping E/ANR_LOG: >>> msg's executing time is too long
2022-04-29 23:01:45.947 22416-22416/io.github.jan.shopping E/ANR_LOG: Blocked msg = { when=-1s781ms what=155 target=android.app.ActivityThread$H obj=/data/data/io.github.jan.shopping/code_cache/startup_agents/50cdcce7-agent.so=irsocket-19 } , cost  = 1781 ms
2022-04-29 23:01:45.948 22416-22416/io.github.jan.shopping E/ANR_LOG: >>>Current msg List is:
2022-04-29 23:01:45.948 22416-22416/io.github.jan.shopping E/ANR_LOG: Current msg <1> = { when=-1s777ms what=0 target=android.os.Handler callback=androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1 }
2022-04-29 23:01:45.948 22416-22416/io.github.jan.shopping E/ANR_LOG: Current msg <2> = { when=+1s253ms what=0 target=android.os.Handler callback=kotlinx.coroutines.android.HandlerContext$scheduleResumeAfterDelay$$inlined$Runnable$1 }
2022-04-29 23:01:45.948 22416-22416/io.github.jan.shopping E/ANR_LOG: Current msg <3> = { when=+1s460ms what=0 target=android.os.Handler callback=kotlinx.coroutines.android.HandlerContext$scheduleResumeAfterDelay$$inlined$Runnable$1 }
2022-04-29 23:01:45.948 22416-22416/io.github.jan.shopping E/ANR_LOG: >>>CURRENT MSG DUMP OVER<<<
I don't know if that says something but I'm getting my data from an HTTP api (not HTTPS)
k

Kirill Grouchnikov

05/01/2022, 11:30 PM
ANR usually means that you're blocking the main thread for too long. So probably your network request is not running asynchronously, but rather in the main thread
329 Views