Tim Autin
Tim Autin

Reputation: 6165

Android app slow to start (1s lost before layout inflation)

I'm trying to improve my app's startup time. I noticed that compared to a fresh new project, my app looses ~1 sec right after startup. Here are my app's first logcat lines:

2021-03-15 19:25:48.897 11997-11997/? I/om.my.ap: Late-enabling -Xcheck:jni
2021-03-15 19:25:48.924 11997-11997/? E/om.my.ap: Unknown bits set in runtime_flags: 0x8000
2021-03-15 19:25:48.989 11997-11997/com.my.app I/om.my.ap: The ClassLoaderContext is a special shared library.
2021-03-15 19:25:49.908 11997-11997/com.my.app I/Perf: Connecting to perf service.

And here are the first lines of a fresh project :

2021-03-15 19:39:50.605 14661-14661/? I/e.myapplicatio: Late-enabling -Xcheck:jni
2021-03-15 19:39:50.630 14661-14661/? E/e.myapplicatio: Unknown bits set in runtime_flags: 0x8000
2021-03-15 19:39:50.899 14661-14661/com.example.myapplication I/Perf: Connecting to perf service.

As you can see, my app spends ~1s between the The ClassLoaderContext is a special shared library line and the Connecting to perf service line. The fresh project does not print the The ClassLoaderContext is a special shared library line, so I guess it is related to the issue. What is being done at that step?

Upvotes: 2

Views: 2092

Answers (1)

Tim Autin
Tim Autin

Reputation: 6165

Alright, I found the culprit: Google Maps. Removing that line from my Gradle file removes the The ClassLoaderContext is a special shared library line in the log and the 1 sec lag.

api 'com.google.android.gms:play-services-maps:17.0.0'

So, I guess there's nothing I can do except looking for another mapping solution...

For those interested, you can star the issue I reported here: https://issuetracker.google.com/issues/182813980

Upvotes: 1

Related Questions