Skip to content

Type mismatch: inferred type is (Mutable)List<Address!>? but MutableList<Address> was expected #41

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

Open
Haseeba393 opened this issue Oct 7, 2022 · 5 comments

Comments

@Haseeba393
Copy link

I'm using this library to fetch locations names, but while building on Android side it is giving me this error:
Type mismatch: inferred type is (Mutable)List<Address!>? but MutableList

was expected

Here is my environment
"react-native": "0.69.1"
"@timwangdev/react-native-geocoder": "^1.0.0-alpha.7"

@gaelhuot
Copy link

It happened to me while trying to compile with SDK 33.

The error comes from GeocoderModule.kt:45

[...]
if (swLat != null && swLng != null && neLat != null && neLng != null) {
    addresses = geocoder.getFromLocationName(addressName, maxResults, swLat, swLng, neLat, neLng)
} else {
    addresses = geocoder.getFromLocationName(addressName, maxResults)
}
[...]

However, no problems when using SDK 32. That's because the "Geocoder.getFromLocationName" method has been deprecated in API 33 : Geocoder.getFromLocationName (old) and has been replaced with this one Geocoder.getFromLocationName (new)

@Haseeba393
Copy link
Author

I think it would be great to make a PR for this?

@gaelhuot
Copy link

I made a fork including a quick-fix for API 33 only until I make something cleaner for a pull-request
https://github.com/gaelhuot/react-native-geocoder-reborn

"dependencies": {
    ...
    "@timwangdev/react-native-geocoder": "https://github.com/gaelhuot/react-native-geocoder-reborn",
    ...
}

@pierroo
Copy link

pierroo commented Dec 26, 2022

Just passing by to thank you @gaelhuot , that was really helpful!
Since this one is no longer maintained, at least I can patch-package the change you provided.

@brazzoduro26
Copy link

I was able to solve with SDK 33 in this way:

File: GeocoderModule.tk

line 46 -
addresses = geocoder.getFromLocationName(addressName, maxResults, swLat, swLng, neLat, neLng) as MutableList<Address>

line 48 -
addresses = geocoder.getFromLocationName(addressName, maxResults) as MutableList<Address>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants