AdevintaSpain / Leku

:earth_africa: Map location picker component for Android. Based on Google Maps. An alternative to Google Place Picker.
https://adevintaspain.github.io/Leku/
Apache License 2.0
764 stars 170 forks source link

Starting and loading an activity takes up to 30 seconds - ANR #374

Closed bardss closed 1 year ago

bardss commented 1 year ago

Describe the bug LocationPickerActivity is loading up to 30 seconds. Some devices throw an ANR.

To Reproduce Just opening an LocationPickerActivity.

Expected behavior Load quicker, how it used to be. We use Leku library in production since 2017. Issue appear recently.

Info Required Until release month ago, we used versions (worked fine):

Issue appeared when we bumped location services to the newest version of play location services, so:

I also tested it with newest version of Leku library and issue still exist:

I tested it with different version for compatibility those versions look like last ones that work together properly without long loading issue:

That is how I initialize LocationPickerActivity:

            val locationPickerIntent = LocationPickerActivity.Builder()
                .withLocation(
                    latitude ?: DEFAULT_LATITUDE,
                    longitude ?: DEFAULT_LONGITUDE
                )
                .withGeolocApiKey(API_KEY)
                .withSearchZone(EVENT.SEARCH_ZONE_SPAIN)
                .withDefaultLocaleSearchZone()
                .shouldReturnOkOnBackPressed()
                .withSatelliteViewHidden()
                .withGooglePlacesApiKey(API_KEY)
                .withGoogleTimeZoneEnabled()
                .withUnnamedRoadHidden()
                .build(it)

and then start an activity for a result.

Our target/support sdk:

    minSdkVersion = 23
    targetSdkVersion = 33
    compileSdkVersion = 33

Screenshots

Smartphone:

Additional context Issue exist while using both debug and production api keys.

In readme you state that supported google location version is 18.1.0 but I also see library bump to 21.0.1. Which one is a truth? Is 18.1.0 an maximum supported version?

Let me know if I can provide any more context.

ferranpons commented 1 year ago

@bardss I'm trying to reproduce it but I'm not able to raise an ANR on opening the LocacionPickerActivity. Please could you provide more context?

Are you opening it from a Fragment? Activity? Using some kind of navigation pattern? When building it which is the context are you using (I see an "it" on your code)? Is it possible that ANR is raised there but the LocationPickerActivity is not the cause? Maybe you have a leak somewhere else and it is being stuck on that activity by chance?

ferranpons commented 1 year ago

@bardss I assume you solved the problem. I close the issue. If you are still experiencing this issue please let me know.