google-maps-services-java icon indicating copy to clipboard operation
google-maps-services-java copied to clipboard

Unable to create instance of class com.google.maps.GeocodingApi$Response. Registering an InstanceCreator or a TypeAdapter for this type, or adding a no-args constructor may fix this problem.

Open joaorodrigo opened this issue 2 years ago • 3 comments

Hello, I have a problem running my Java Spring Boot application with a native image.

When searching for an address I get the error: Unable to create instance of class com.google.maps.GeocodingApi$Response. Registering an InstanceCreator or a TypeAdapter for this type, or adding a no-args constructor may fix this problem.

The error only occurs when compiling with native image, when using JVM the problem does not occur.

Spring Boot: 3.0.6 GraalVM: 22.3.1 JDK: 17

joaorodrigo avatar Jun 28 '23 20:06 joaorodrigo

If you would like to upvote the priority of this issue, please comment below or react with :+1: so we can see what is popular when we triage.

@joaorodrigo Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

wangela avatar Jun 28 '23 20:06 wangela

Having the same issue with NearbySearchRequest: Unable to create instance of class com.google.maps.NearbySearchRequest$Response. Registering an InstanceCreator or a TypeAdapter for this type, or adding a no-args constructor may fix this problem.

locagen avatar Aug 03 '23 13:08 locagen

There is a similar behaviour while using TimeZoneApi with Quarkus native images, we need to add annotation RegisterForReflection, but the inner Reponse class is not public, so not able to make it work. Changing the inner class Response to public will solve the issue.

threw an exception: java.lang.RuntimeException: Unable to create instance of class com.google.maps.TimeZoneApi$Response. Registering an InstanceCreator or a TypeAdapter for this type, or adding a no-args constructor may fix this problem.

castelloms avatar Oct 27 '23 22:10 castelloms